[R] .libPaths() can not deal non-latin characters?
Jinsong Zhao
j@zh@o @end|ng |rom ye@h@net
Tue Oct 22 02:14:00 CEST 2019
The folder is there. The problem is caused by Sys.glob() in .libPaths().
Sys.glob() will return character(0) when the path contains Chinese
characters.
Here is another demo:
> dir.exists("c:/Users/zjs/Desktop/中文/R")
[1] TRUE
> Sys.glob("c:/Users/zjs/Desktop/中文/R")
character(0)
> Sys.glob("c:/Users/zjs/Desktop/中*/R")
character(0)
> Sys.glob("c:/Users/zjs/Desktop/*文/R")
character(0)
> Sys.glob("c:/Users/zjs/Desktop/*/R")
[1] "c:/Users/zjs/Desktop/中文/R"
Best,
Jinsong
On 2019/10/21 22:49, Henrik Bengtsson wrote:
> The folder must exist. If not, .libPaths() *silently* ignores it. Could
> that be it?
>
> Henrik
>
>
>
> On Mon, Oct 21, 2019, 02:32 Jinsong Zhao <jszhao using yeah.net
> <mailto:jszhao using yeah.net>> wrote:
>
> Hi there,
>
> I have a computer run Win10 with user names in Chinese. I installed
> R on it. It can run normally. When I installed a package, for
> example, ada, then the library would be installed into "C:/Users/中
> 文/Documents/R/win-library/3.6", where "中文" is my user name.
>
> > library(ada)
> Error in library(ada) : there is no package called ‘ada’
>
> > .libPaths()
> [1] "C:/Program Files/R/R-3.6.1/library"
>
> > .libPaths(c("C:/Users/中文/Documents/R/win-library/3.6",
> .libPaths()))
> > .libPaths()
> [1] "C:/Program Files/R/R-3.6.1/library"
>
> you will find that .libPaths() does not accept the path with Chinese
> (I think non-latin characters may not be accepted).
>
> I also tried to install the package to other directory with Chinese
> character, and then set the .libPaths, and failed.
>
> Is it the features?
>
> Any hints? Thanks in advance.
>
> Best,
> Jinsong
More information about the R-help
mailing list