ropensci / allodb

An R package for biomass estimation at extratropical forest plots.
https://docs.ropensci.org/allodb/
GNU General Public License v3.0
36 stars 11 forks source link

If using data.frame(), then use stringsAsFactors = FALSE #142

Closed maurolepore closed 3 years ago

maurolepore commented 3 years ago

Closes https://github.com/forestgeo/allodb/issues/139

maurolepore commented 3 years ago

I see that the latest commit on master passed on Ubuntu with R-release (4) but failed with R-oldrel (3.6).

One of the most important breaking changes moving from R 3.6 to R 4 was that the default for stringsAsFactors went from TRUE to FALSE.

A global search for data.frame shows the package still contains many calls to data.frame() and that the argument stringsAsFactors is unused, so I used RStudio's "replace all" tool to replace "data.frame(" with "data.frame(stringsAsFactors = FALSE,". This seems to have fixed the problem

--

As we discussed earlier, an alternative solution is to replace data.frame() with tibble(), but I kept data.frame() for now as I see a non-straightforward error in the vignette. I suggest you move on with what you have now but work on a separate PR to figure out why tibble() isn't working smoothly -- this likely suggests there is a bug hiding somewhere in the code and using tibble() can help expose then fix that bug.