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 [[alternative HTML version deleted]]
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 at 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 > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
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 at yeah.net > <mailto:jszhao at 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