由于用户名带有重音符号,安装 R 包时出现问题

由于用户名带有重音符号,安装 R 包时出现问题

我在 Windows 10 上使用 RStudio,尝试安装软件包“hms”,但没有成功。问题似乎出在用户帐户中我的重音名称上。错误如下:

* installing *source* package 'hms' ...
** package 'hms' successfully unpacked and MD5 sums checked
** using staged installation
Warning in file(file, if (append) "a" else "w") :
  cannot open file 'C:/Users/Lums/Documents/R/win-library/3.6/00LOCK-hms/00new/hms/DESCRIPTION': No such file or directory
Error in file(file, if (append) "a" else "w") : 
  cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'hms'
* removing 'C:/Users/Luís/Documents/R/win-library/3.6/hms'
Warning in install.packages :
  installation of package ‘hms’ had non-zero exit status

因此,与我通过谷歌搜索发现的类似问题相反(错误在于在用户文件夹中为带有重音字母的包创建文件夹),这里似乎在下载文件后,由于重音字母而无法访问它(它将路径中的 Luís 更改为 Lums)。我该怎么做才能解决这个问题?(这不是 hms 包特有的问题,因为我认为几个月前我已经在其他包中遇到过同样的问题)

答案1

我遇到了同样的问题,并通过在安装软件包之前指定默认主目录解决了该问题:

Sys.setenv(HOME = "C:/Users/Rémi/Documents")

我在这里找到了这个:https://stackoverflow.com/questions/47732049/change-home-directory-for-r

相关内容