Installing lavaan R package in Linux has some prerequisites. My experience in Linux Mint 18.1 is that the following code does the job.
In a Linux terminal do:
Then, in R install the Matrix package:
and (normally) without any problem:
An alternative option is
Further, since the package "semPlot" is a natural friend to "lavaan" it seems natural to additionally install a couple of packages with the command (in a linux terminal)
Notice for Linux Mint users
Probably it is a good idea to add to /etc/apt/sources.list
(to a terminal
)
execute the line
Source: https://cran.r-project.org/bin/linux/ubuntu/README.html
Then, do not forget to add the corresponding key. In a terminal type
and
Source: https://askubuntu.com/questions/610449/w-gpg-error-the-following-signatures-couldnt-be-verified-because-the-public-k
In case an error message of the form
ERROR: failed to lock directory ‘R/x86_64-pc-linux-gnu-library/3.2’ for modifyingTry removing ‘/home/epdiamantopoulos/R/x86_64-pc-linux-gnu-library/3.2/00LOCK-nloptr’
when installing semPlot then probably you should remove the folder with rm -rf command, that is:
and retry with
and then
source: https://stackoverflow.com/questions/14382209/r-install-packages-returns-failed-to-create-lock-directory
Enjoy!
In a Linux terminal do:
sudo apt-get install xorg-dev libjpeg-dev zlib1g-dev gcc g++ build-essential liblapack-dev libtiff5 libtiff-dev liblapack-dev liblapack3 libopenblas-base libopenblas-dev gfortran
Then, in R install the Matrix package:
install.packages("Matrix")
and (normally) without any problem:
install.packages("lavaan")
An alternative option is
install.packages("lavaan", dependencies=TRUE, repos='http://cran.rstudio.com/')
Further, since the package "semPlot" is a natural friend to "lavaan" it seems natural to additionally install a couple of packages with the command (in a linux terminal)
and at R environment
sudo apt-get install
libxml2-dev r-cran-xml libcurl4-openssl-dev
install.packages(c('MatrixModels', 'quantreg', 'car'))
Notice for Linux Mint users
Probably it is a good idea to add to /etc/apt/sources.list
(to a terminal
sudo nano /etc/apt/sources.list
execute the line
deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu xenial/
for example:
deb https://ftp.cc.uoc.gr/mirrors/CRAN//bin/linux/ubuntu xenial/
Then, do not forget to add the corresponding key. In a terminal type
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
In case an error message of the form
ERROR: failed to lock directory ‘R/x86_64-pc-linux-gnu-library/3.2’ for modifyingTry removing ‘/home/epdiamantopoulos/R/x86_64-pc-linux-gnu-library/3.2/00LOCK-nloptr’
when installing semPlot then probably you should remove the folder with rm -rf command, that is:
sudo rm -rf /home/epdiamantopoulos/R/x86_64-pc-linux-gnu-library/3.2/00LOCK-nloptr
and retry with
install.packages("OpenMx", dependencies=TRUE, INSTALL_opts = c('--no-lock'))
and then
install.packages("semPlot", dependencies=TRUE, INSTALL_opts = c('--no-lock'))
source: https://stackoverflow.com/questions/14382209/r-install-packages-returns-failed-to-create-lock-directory
Enjoy!
This comment has been removed by a blog administrator.
ReplyDelete