Please don't post code as an image. It is also advised to post a reproducible example.
In any case, in your example on R 3.6, all_bins
is a factor
. However, in your R 4.1 example, all_bins
is a character
vector.
This is because of the change in R 4.0.0.:
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().
In order to reproduce the server behaviour on your local machine, when you read in bins in your local version of R, you need to add the argument stringsAsFactors = TRUE
, e.g.:
bins <- read.csv("path/to/file", stringsAsFactors = TRUE)
This should solve this particular issue. However, you may run into other differences between R 3.6 and R 4.1 on different machines. I would recommend running the same version of R and packages on both machines, perhaps using renv
, if you want to ensure the output is the same.