Two different R versions and invoking of older R version - r

I recently installed latest version of R(3.3.1) on my mac but somehow the R is still pointing to the old R version which I had. When R is invoked in command line it show the new version but on typing version in R environmnet the older(3.0.2) is shown.
What changes should be made so as to update to newer R version?
Also I deleted previous versions directories from Frameworks.
Additionally probably because of this issue I get an error when I start R studio.
ls /Library/Frameworks/R.framework/Versions/
3.3 Current
===========================
user1#my-mac:~$ R
Error in objects(db.pos, all.names = TRUE) :
2 arguments passed to .Internal(ls) which requires 3
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)
....
....
Error in gzfile(file) : invalid 'encoding' argument
During startup - Warning message:
unable to restore saved data in .RData
> version
_
platform x86_64-apple-darwin10.8.0
arch x86_64
os darwin10.8.0
system x86_64, darwin10.8.0
status
major 3
minor 0.2
year 2013
month 09
day 25
svn rev 63987
language R
version.string R version 3.0.2 (2013-09-25)
nickname Frisbee Sailing

In Mac, point rstudio to the newer version of R using the RSTUDIO_WHICH_R environment variable.
export RSTUDIO_WHICH_R=/usr/local/bin/R

Related

R studio initialization stuck in an old version

I have installed the most recent version of R just some minutes ago (version 4.04).
But when I open R studio and run version in my console, it appears to be opened still using the 3.6.1 version:
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 6.1
year 2019
month 07
day 05
svn rev 76782
language R
version.string R version 3.6.1 (2019-07-05)
nickname Action of the Toes
How can I open R studio trough the new version of R I just installed?
You just have to uninstall the old versions of R gathered in your computer from the Panel Control and RStudio will initiate with the oldest version of R.

Error installed R library with version 3.6.0 when only version 3.4 is required

I´m trying to install the library ssev: https://cran.r-project.org/web/packages/ssev/index.html
On a machine with R 3.6.0
install.packages("ssev")
And I´m getting the following error:
“unable to access index for repository http://cran.rstudio.com/src/contrib:
cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES'”
Warning message:
“package ‘ssev’ is not available (for R version 3.6.0)”
What I do not understand is why I´m getting this error, when the requiered version for this library is 3.4, as shown in CRAN:
The installation does work with a more recent versions of R like 3.6.3, but in the machine I need it I do not have the option to install a newer version.
I'm using R version 3.6.1 and only getting a warning about the using the library. Generally, you can ignore these and it will still work. If it's not, try updating the package and post the results of trying to load the library and also run version to show info on your setup as I did below:
> library(ssev)
Warning messages:
1: In recycle.data(data, FALSE, length(x), units) :
reached elapsed time limit
2: package ‘ssev’ was built under R version 3.6.3
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 6.1
year 2019
month 07
day 05
svn rev 76782
language R
version.string R version 3.6.1 (2019-07-05)
nickname Action of the Toes

R Error in install.packages : permission denied

I'm trying to install packages employing the command install.packages() in Rstudio Version 1.1.453:
R version 3.5.0 (2018-04-23) -- "Joy in Playing"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
with R Version 3.5 in Windows 10:
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 5.0
year 2018
month 04
day 23
svn rev 74626
language R
version.string R version 3.5.0 (2018-04-23)
nickname Joy in Playing
I'm getting the following error:
Error in install.packages :
cannot open file 'C:/Users/Gabriel/Documents/R/win-library/3.5/file19281116cee/Rcpp/doc/Rcpp-attributes.pdf':
Permission denied
Thanks a lot for your help.
I solved it with this answer. It's R is installed as if it needs constant admin privileges. That answer shows the correct way of doing it without running into the problem again.
I ran into same problem, most times it is an antivirus shield issue! Ensure all shields are down, then retry installation.
I had the same problem and it gave me a headache but the Error with : Permission Denied, as you put it across can be solved by checking the antivus. R studio can be blacklisted by the antivirus, so look at the setting. I am using AVG and surely the application was blacklisted. When I removed it from th blacklist, packages were installed successfully

R .libPaths() different in RStudio and in terminal - how to update on terminal

I'm not sure if this question has been asked before, but I didn't see anything come up at first glance. I am struggling with R library paths when trying to run an R script from the console using:
Rscript myfile.R
The libraries loaded in myfile.R are not loading up correctly. In RStudio, my library path is:
# run from console in RStudio
> .libPaths()
[1] "/Library/Frameworks/R.framework/Versions/3.4/Resources/library"
> version
_
platform x86_64-apple-darwin15.6.0
arch x86_64
os darwin15.6.0
system x86_64, darwin15.6.0
status
major 3
minor 4.1
year 2017
month 06
day 30
svn rev 72865
language R
version.string R version 3.4.1 (2017-06-30)
nickname Single Candle
However, when I check the library path of R from the command line like so, I receive the following wrong path:
Rscript -e 'print(.libPaths())'
[1] "/Users/Home/anaconda2/lib/R/library"
Rscript -e 'print(version)'
_
platform x86_64-apple-darwin11.4.2
arch x86_64
os darwin11.4.2
system x86_64, darwin11.4.2
status
major 3
minor 2.2
year 2015
month 08
day 14
svn rev 69053
language R
version.string R version 3.2.2 (2015-08-14)
nickname Fire Safety
The RStudio path returned is actually not showing the prefix, which is actually:
/Users/Home/Library/Frameworks/R.framework/Versions/3.4/Resources/library
So my question is, how do I change the wrong path (run in terminal) to the right path (run in RStudio) for my R libraries with .libPaths() ?
Thanks!

Rstudio hangs when loading XLConnect

I'm getting a hang in RStudio when I try and load XLConnect. It works find when I try from the same R console outside RStudio.
i.e. in RGui (64-bit)
R version 3.2.2 (2015-08-14) -- "Fire Safety"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
> library(XLConnect)
Loading required package: XLConnectJars
XLConnect 0.2-11 by Mirai Solutions GmbH [aut],
Martin Studer [cre],
The Apache Software Foundation [ctb, cph] (Apache POI, Apache Commons
Codec),
Stephen Colebourne [ctb, cph] (Joda-Time Java library)
http://www.mirai-solutions.com ,
http://miraisolutions.wordpress.com
But when I run in Rstudio the same R console hangs. I've confirmed that rJava loads so I think I have my Java environment correct
R version 3.2.2 (2015-08-14) -- "Fire Safety"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
> library(XLConnect)
Loading required package: XLConnectJars
Appreciate any thoughts on what the issue is - it works fine on my laptop so not sure what's different
Regards
Dave
Seems to be an Rstudio issue fixed in the latest version - I updated Rstudio to 0.99.491 (from an earlier 0.99.x release but not sure the version) and it now works fine.
edit - although it sometimes still appears to hang but eventually the package loads?

Resources