Here, we can see that the R path does not include the path to TeX binaries:
> Sys.getenv("PATH")
[1] "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin" So, if you try to call the latex() function, it will give an error message like that
:library(Hmisc) # Load Hmisc to load latex()x <- matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','this that'))) # From latex() exampleslatex(x)error /bin/sh: latex: command not founderror in system(cmd, intern = TRUE, wait = TRUE) : error in running commandsh: xdvi: command not found
To add the Tex PATH into the R envirnment, following my last blog to create .Rprofile and add the following command to the file:
Sys.setenv(PATH=paste(Sys.getenv("PATH"),"/usr/texbin",sep=":"))
After reboot R, you will find the tex path was added.
> Sys.getenv("PATH")
[1] "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin"
No comments:
Post a Comment