Search code examples
rfileencodingrstudio

RStudio stopped reading accents after update


I updated Rstudio and a few packages a few days ago. Now, I wanted to run a script that I usually run bi-weekly, but now it cannot read the files due to accented folder names. Previously I had no problem reading these folders. Here's the code:

wd <- "C:/Users/name/Opinião/"
# Get all questionnaires 
filenames <- list.files(path = paste0(wd,"Questionarios/"), pattern="*.csv$", full.names = TRUE)

Now I get an error in Opinião. The system is unable to read the accent. If I try to access the folder manually, I get "C:/Users/name/Opinião". I'm not sure what the issue could be since it worked before the update, and LOCALE corresponds to Portuguese. I could manually change the folder's name, but then the files also have accents, and it would be a bit time-consuming doing it manually.

Any ideas? Here is sessionInfo()

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Portugal.1252 
[2] LC_CTYPE=Portuguese_Portugal.1252   
[3] LC_MONETARY=Portuguese_Portugal.1252
[4] LC_NUMERIC=C                        
[5] LC_TIME=Portuguese_Portugal.1252    
system code page: 65001

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

other attached packages:
[1] readxl_1.3.1      sjmisc_2.8.5      lfactors_1.0.4   
[4] stringr_1.4.0     lubridate_1.8.0   data.table_1.13.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7       magrittr_2.0.1   insight_0.10.0  
 [4] tidyselect_1.1.0 lattice_0.20-41  R6_2.4.1        
 [7] rlang_0.4.12     fansi_0.4.1      dplyr_1.0.7     
[10] tools_4.0.2      grid_4.0.2       utf8_1.1.4      
[13] DBI_1.1.1        ellipsis_0.3.2   assertthat_0.2.1
[16] tibble_3.1.6     lifecycle_1.0.0  crayon_1.4.2    
[19] purrr_0.3.4      vctrs_0.3.8      sjlabelled_1.1.7
[22] glue_1.4.2       stringi_1.5.3    cellranger_1.1.0
[25] compiler_4.0.2   pillar_1.6.5     generics_0.1.0  
[28] pkgconfig_2.0.3  zoo_1.8-8  

The problem seems to be with folder and file names as I can write in R

> name <- "Opinião"
> name
[1] "Opinião"

Update: The problem is only using RStudio.


Solution

  • everyone. This problem happened to me, today. I spend some time trying to fix it, but was worthless. Curious thing, at the files panel the files names was correct, but just when I have to put the files names as strings the problem occurs. Well, I updated the R base and Rstudio and the IDE turned back to recognize the names accents. I don't know why some of then still have problems, but the most recent ones is working well.