write.table() 错误无法打开 R 中被拒绝的文件权限
write.table() error cannot open file permission denied in R
我正在尝试在 R 中执行以下命令以将数据集导出为 .txt 到我当前的工作目录(我的桌面):
write.table(grouped_dataset, "tidy_dataset.txt", row.names=FALSE)
但我得到了相同的结果:
Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file 'tidy_dataset.txt': Permission denied
我一直在 Whosebug 和其他论坛上进行搜索,但我的问题没有答案,这真的很令人沮丧。我特别需要使用“write.table()”,没有其他功能。
这是我的 sessionInfo() 数据:
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8.1 x64 (build 9600)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Bolivarian Republic of Venezuela.1252 LC_CTYPE=Spanish_Bolivarian Republic of
Venezuela.1252
[3] LC_MONETARY=Spanish_Bolivarian Republic of Venezuela.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Bolivarian Republic of Venezuela.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.5.0 stringr_1.4.0 dplyr_1.0.2 purrr_0.3.4 readr_1.3.1 tidyr_1.1.2
tibble_3.0.3
[8] ggplot2_3.3.2 tidyverse_1.3.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 cellranger_1.1.0 pillar_1.4.6 compiler_4.0.2 dbplyr_1.4.4 tools_4.0.2
[7] jsonlite_1.7.0 lubridate_1.7.9 lifecycle_0.2.0 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.7
[13] reprex_0.3.0 cli_2.0.2 DBI_1.1.0 rstudioapi_0.11 haven_2.3.1 withr_2.2.0
[19] xml2_1.3.2 httr_1.4.2 fs_1.5.0 generics_0.0.2 vctrs_0.3.4 hms_0.5.3
[25] grid_4.0.2 tidyselect_1.1.0 glue_1.4.2 R6_2.4.1 fansi_0.4.1
readxl_1.3.1
[31] modelr_0.1.8 blob_1.2.1 magrittr_1.5 backports_1.1.9 scales_1.1.1
ellipsis_0.3.1
[37] rvest_0.3.6 assertthat_0.2.1 colorspace_1.4-1 utf8_1.1.4 stringi_1.4.6
munsell_0.5.0
[43] broom_0.7.0 crayon_1.3.4
谢谢!
解决了!问题出在我的防病毒软件 Avast 上。一旦我禁用它一段时间,我就可以在我的工作目录中写入“tidy_dataset.txt”,而不会出现 R 脚本的错误或警告。
希望这对以后的人有所帮助。
我正在尝试在 R 中执行以下命令以将数据集导出为 .txt 到我当前的工作目录(我的桌面):
write.table(grouped_dataset, "tidy_dataset.txt", row.names=FALSE)
但我得到了相同的结果:
Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file 'tidy_dataset.txt': Permission denied
我一直在 Whosebug 和其他论坛上进行搜索,但我的问题没有答案,这真的很令人沮丧。我特别需要使用“write.table()”,没有其他功能。
这是我的 sessionInfo() 数据:
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8.1 x64 (build 9600)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Bolivarian Republic of Venezuela.1252 LC_CTYPE=Spanish_Bolivarian Republic of
Venezuela.1252
[3] LC_MONETARY=Spanish_Bolivarian Republic of Venezuela.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Bolivarian Republic of Venezuela.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.5.0 stringr_1.4.0 dplyr_1.0.2 purrr_0.3.4 readr_1.3.1 tidyr_1.1.2
tibble_3.0.3
[8] ggplot2_3.3.2 tidyverse_1.3.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 cellranger_1.1.0 pillar_1.4.6 compiler_4.0.2 dbplyr_1.4.4 tools_4.0.2
[7] jsonlite_1.7.0 lubridate_1.7.9 lifecycle_0.2.0 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.7
[13] reprex_0.3.0 cli_2.0.2 DBI_1.1.0 rstudioapi_0.11 haven_2.3.1 withr_2.2.0
[19] xml2_1.3.2 httr_1.4.2 fs_1.5.0 generics_0.0.2 vctrs_0.3.4 hms_0.5.3
[25] grid_4.0.2 tidyselect_1.1.0 glue_1.4.2 R6_2.4.1 fansi_0.4.1
readxl_1.3.1
[31] modelr_0.1.8 blob_1.2.1 magrittr_1.5 backports_1.1.9 scales_1.1.1
ellipsis_0.3.1
[37] rvest_0.3.6 assertthat_0.2.1 colorspace_1.4-1 utf8_1.1.4 stringi_1.4.6
munsell_0.5.0
[43] broom_0.7.0 crayon_1.3.4
谢谢!
解决了!问题出在我的防病毒软件 Avast 上。一旦我禁用它一段时间,我就可以在我的工作目录中写入“tidy_dataset.txt”,而不会出现 R 脚本的错误或警告。
希望这对以后的人有所帮助。