Error in if (num_colors <256) when importing csv files?

Viewed 174

I recently updated to R 4.03 and since doing so I have had difficulty uploading csv files in R studio. This is true whether trying to import with code or when manually importing using the tab Environment -> "Import Dataset." The error message I receive is "Error in if (num_colors < 256) { : missing value where TRUE/FALSE needed."

Here is the code I am using:

library(readr) 
df <- read_csv("df.csv")

Error in if (num_colors < 256) { : missing value where TRUE/FALSE needed`

I thought this may have something to do with the package "crayon" but loading this library does not seem to make a difference.

Furthermore, when I save "df.csv" as an excel file "df.xlsx" I am able to load the dataset without issue using the following code

library(readxl)
df <- read_excel(df.xlsx)

I don't encounter this problem when using R 4.0.2 on a different machine, so I suspect this issue may be related to the upgrade.

Any insights are appreciated.

Update: Newish R user and I appreciate everyone's interest in this question. I believe the session is clean. Per Ben's request:

find("read_csv")

[1] "package:readr"

sessionInfo()

R version 4.0.3 (2020-10-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] dplyr_1.0.3 crayon_1.4.1 readxl_1.3.1 plyr_1.8.6 readr_1.4.0

loaded via a namespace (and not attached): [1] Rcpp_1.0.6 rstudioapi_0.13 magrittr_2.0.1 hms_1.0.0 tidyselect_1.1.0 lattice_0.20-41 R6_2.5.0 rlang_0.4.10 fansi_0.4.2
[10] tools_4.0.3 grid_4.0.3 utf8_1.1.4 DBI_1.1.1 cli_2.3.0 ellipsis_0.3.1 assertthat_0.2.1 tibble_3.0.5 lifecycle_0.2.0 [19] Matrix_1.2-18 purrr_0.3.4 vctrs_0.3.6 glue_1.4.2 compiler_4.0.3 pillar_1.4.7 cellranger_1.1.0 generics_0.1.0 pkgconfig_2.0.3

1 Answers

I'd suggest updating RStudio to the latest version as well as R.

That did the trick for me.

Edit

In view of Ben's request below.

R version: 4.0.4; RStudio version: 1.4.1103

Related