I am reading some excel data in R in a loop because I have a bunch of files. This is what I do regularly. I have some problems, although I'm not sure how to make a reproducible example. Therefore, I have all the files that I want in the same directory, and I read them when using this set of commands:
#
So, this is a tool for reading in files, but also, using the warn switch, I can diagnose which files are not reading correctly.
Now the problem : from a new reboot, and I can rename and save the excel files in a directory. If, however, I run the above R code, I lose the permission to save or rename the excel file where the loop was broken (there are small problems with excel files that need to be fixed manually). For example, if I try to rename the file on which the loop was broken, I get this Windows error:
The action cannot be performed because the file is open in the RStudio R Session.
If I reboot, I can change this file again. But before rebooting, I cannot save or rename the file. Can someone explain this behavior when R or Rstudio seem to accept my rights?
Update . If I close RStudio, permissions will be returned. If I execute the same sequence of commands above using RGUI for Windows, the replication problem indicating the problem is not an RStudio problem.
sessionInfo() R version 3.3.2 (2016-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] stringr_1.1.0 readxl_0.1.1 lubridate_1.6.0 dplyr_0.5.0 purrr_0.2.2 readr_1.0.0 tidyr_0.6.0 tibble_1.2 [9] ggplot2_2.2.0 tidyverse_1.0.0 loaded via a namespace (and not attached): [1] Rcpp_0.12.7 assertthat_0.1 R6_2.2.0 grid_3.3.2 plyr_1.8.4 DBI_0.5-1 gtable_0.2.0 [8] magrittr_1.5 scales_0.4.1 stringi_1.1.2 lazyeval_0.2.0 tools_3.3.2 munsell_0.4.3 colorspace_1.3-0
source share