allen2017
win下的rstudio对非ascii的用户名支持不好是个老问题了,不过目前看来没有补丁,在社区里倒是有人提出修复方法,而且从反馈看问题也暂时解决了,参见这里
Kevin 的解决方案:
Hi Julien,
Thanks for the follow up. We've pinned down this particular issue to be due to RStudio mis-encoding the values set for the HOME and R_USER environment variables on startup, and we'll hopefully have a fix in a future release -- unfortunately, I don't think it will make it into the v1.0 release, but hopefully a patch release soon after.
For now, I think you can work around this with some custom entries in your ~/.Rprofile:
.First <- function() {
# RStudio-specific startup
if (!is.na(Sys.getenv("RSTUDIO", unset = NA)) &&
Sys.info()[["sysname"]] == "Windows")
{
# work around mis-encoded environment variables
USERPROFILE <- Sys.getenv("USERPROFILE")
HOME <- file.path(USERPROFILE, "Documents", fsep = "\\")
R_USER <- HOME
R_LIBS_USER <- file.path(HOME, "R", "win-library", getRversion()[1, 1:2], fsep = "\\")
Sys.setenv(
HOME = HOME,
R_USER = R_USER,
R_LIBS_USER = R_LIBS_USER
)
# update library paths
if (!isTRUE(file.info(R_LIBS_USER)$isdir))
dir.create(R_LIBS_USER, recursive = TRUE)
.libPaths(R_LIBS_USER)
}
}
Please let us know if you encounter other issues; there are likely a number of other latent issues related to the handling of non-ASCII characters on Windows.
Best,
Kevin