Skip to content

update scripts to future proof against R 4.0.0+ updates

  • https://stat.ethz.ch/pipermail/r-announce/2020/000653.html

    R now uses a stringsAsFactors = FALSE default, and hence by default no longer converts strings to factors in calls to data.frame() and read.table().

  • this breaks all instances of levels() being used on data.frames read using read.csv()

  • switching to unique() solves this

  • unique() used on factors (R < 4.0.0, currently on the cluster) still returns the same values as levels(), but as a factor, which does not cause problems (but is a little ugly in interactive use)

Merge request reports