Issue with R packages installed with root - r

For some reason, I could not install the rJava package without root privilege (using sudo R and then install.packages('rJava')). It should have solved my problem, however I can only use this package when launching R with sudo R. If I launch it without sudo, R will act as if this package is not installed.
I tried looking at /usr/local/lib/R/site-library, every package belongs to my user and group "staff" except this one, that belongs to root and staff. The rights for every package are rwxrwxr-x and I am in group staff, so I should have all the permissions I need. In addition, I tried changing the owner of the rJava folder to my user and it didn't change anything. Do anybody have any idea why rJava is not recognized if I start R without sudo?
Thanks!

I also had issues installing rJava so I'll outline the steps I took to fix it even though it may be specific to my system. There's at least a chance it will work for you too.
Remove rJava and openjdk:
sudo apt-get purge r-cran-rjava
sudo apt-get purge openjdk-7-jre
Install oracle java:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Reinstall rJava
sudo apt-get install r-cran-rjava
After that everything was hunky-dory. glmulti installed fine as well.

Try unsetting the JAVA_HOME environmental variable before starting R:
unset JAVA_HOME

Related

Cannot install R - Unable to correct problems, you have held broken packages

We followed instructions here - https://rtask.thinkr.fr/installation-of-r-4-0-on-ubuntu-20-04-lts-and-tips-for-spatial-packages/ - to uninstall R:
sudo apt-get purge r-base* r-recommended r-cran-*
sudo apt autoremove
sudo apt update
...seems to have worked because when we run R in command line we get -bash: /usr/bin/R: No such file or directory. However, when we try to install R using:
apt install --no-install-recommends r-base
...version 3.6.3 is installed, not version 4.0 or 4.1. Here is our machine type.
What can we do to get R version 4.1.0 (preferred) installed on our machine? I am worried that, perhaps it is not possible as if it were, v4 would be the default rather than v3... might it be the case that 16.04 is too old for R v4?
Edit: followed the instructions in the comment below, but ran into the following issue:

Are packages deleted when upgrading R on Linux?

Are packages deleted when upgrading R on Linux? I would prefer to just use the default package installation directory, instead of setting up a custom directory.
I'm aware I can setup a custom directory in the following manner:
cat >> ~/.Renviron
R_LIBS=/data/Rpackages/
I just wonder what happens if I don't issue the command above? Will packages be wiped every time I issue the command
sudo apt-get update && sudo apt-get upgrade
, and as a consequence R gets updated to the latest version?
#Jason, when you are doing sudo apt-get update && sudo apt-get upgrade, it just upgrade packages that have a new version in your list of repositories. There is no reason it will modify R packages already installed.
I'm also running Linux and R and the only time I have to re-install R packages is when I re-install my system. My R packages are installed by default in /usr/local/lib/R/site-library

how can i install the packages in r properly and correctly using Rstudio app?

I tried to install "xlsx" package using Rstudio, and i couldn't install it.
I am trying to install my packages using install.packages("xlsxjars"). I already tried doing that from Tools window in Rstudio app, and I tried using the console.
I am using Linux (Gnome 17.04). I get this error:
input
install.packages("xlsxjars")
output
Installing package into ‘/home/aim/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/xlsxjars_0.6.1.tar.gz'
Error in install.packages : error reading from connection
if you get some Errors while installing r packages kind of somthing.so is miising or some packages are missing depending on the version of R, you should try this commands because, i had this kind of errors with R 3.0.x in Ubuntu 14.04
so i upgrade my R version to fix it with the following commands :
sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" »
gpg —keyserver keyserver.ubuntu.com —recv-key E084DAB9
gpg -a —export E084DAB9 | sudo apt-key add -
sudo apt-get —purge remove r-base-core
sudo apt-get update
sudo apt-get -y install r-base
sudo apt-get update
now i can install all packages without errors
I totally agree with the answer of #kissi salim yahia
Just want to add . When you tape in R
install.packages("your_package")
you got some dependencies below.
these one may have troubles sometimes. So just need to install them manually from the SHELL like:
sudo apt-get install r-cran-your_dependencie
I spent a while struggling with that too. Eventually I just gave up as the java in that package was out of date and I would have needed to load older Java up to get it to run. I would suggest readxl instead.
A simple intro to the package can be found here: https://www.datacamp.com/community/tutorials/r-tutorial-read-excel-into-r#readxl

Install of 'R' unstable on Ubuntu

I tried to install R on Ubuntu (14.04) with this command:
sudo apt-get install r-base
The network connection went down during the download / install so I had to end the download (ctrl-c). I retried the same command to restart and it is a mess. There are indications of all kinds of dependency problems. I researched and tried 'sudo apt-get remove r-base' (along with autoremove) and that does not allow me to try to reinstall. In fact, I have tried all kinds of ways to remove but nothing. How can I rectify this? Thank you!

error installing qt-sdk on linux

i have ubuntu-10.10 desktop version i installed following packages using apt-get install
libglib2.0-dev
libSM-dev
libxrender-dev
libfontconfig1-dev
libxext-dev
libgl1-mesa-dev
libglu-meas-dev
i downloaded qt-sdk-linux-x86-opensource-2010.05.1.bin
changed permission of bin file
chmod u+x qt-sdk-linux-x86-opensource-2010.05.1.bin
./qt-sdk-linux-x86-opensource-2010.05.1.bin
it gives me an error like not able to create symbolic link to libQtCore-4.7.0 and installation aborts.
can any one suggest me what is going wrong and how can i over come this issue
You can just install qt-sdk package from Ubuntu repositories, if you must install by hand, try running it with sudo;
sudo ./qt-sdk-linux-x86-opensource-2010.05.1.bin

Resources