BoulderCodeHub / RWDataPlyr

R package to read and manipulate data from RiverWareTM
3 stars 5 forks source link

Ensure getDataForAllScens returns same type for monthly vs annual data #54

Closed rabutler closed 7 years ago

rabutler commented 7 years ago

Why does getDataForAllScens() return year as a character, and why does it return Variable as a factor?

If dealing with annual data, it returns year as numeric, but Variable as a factor, while it returns year as a character and Variable as a character if dealing with monthly data.

rabutler commented 7 years ago

This was found while testing the contents of reading in csv and txt files that were saved using fwrite()

rabutler commented 7 years ago

Think that we want to keep the Variable as a character, even this will have some size disadvantages. Since the defaults of data.table::fread() and readr::read_xxx() are both to keep the strings as not factors, lets go with that for now.

For a 2000 row data frame, the version that has variable as a character is 65 kb, while it is 57 kb if it is stored as a factor. (about 14% bigger)