I'm trying to use the legacy version of R to run a package on Mac.
On Windows there is a switch in the General tab. However, it is not found on Mac RStudio. I referred to this post: https://support.rstudio.com/hc/en-us/articles/200486138-Using-Different-Versions-of-R
And I do not quite understand the 3 options:
Run the installer from CRAN for the R version you want to be current
List item Use the RSwitch utility available at: http://r.research.att.com/
Update the R.framework/Versions/Current directory alias directly
using ln -s
Especially for RSwitch utility, how do I even open/use that?
Thanks!
This old question is again timely, with the move to R version 4.
There is an RSwitch.app available for MacOS 10.14+ that provides this functionality via a menu bar app. You can choose which of your R builds to use, integrating with the standard Mac GUI and with RStudio. (I've had trouble with the newest Mac GUI not working with R 3.6.3 but RStudio seems to work fine with both that and R 4.0.1 along with this RSwitch.app.) The help pages for Rswitch show what's going on underneath, if you prefer to work via a command line.
If you use a standard .pkg via GUI to install a newer version of R it will effectively forget the other versions. You can use the command
pkgutil --forget (path to package name)
with the .pkg to overcome that. (I've had trouble installing from a tarball instead; might just be my incompetence.) Installing an older version from a .pkg won't overwrite a newer version but in that case it might be safest to omit any attempt to instal older Tcl/Tk and Texinfo, selectable with the "Customize" button at the "Installation Type" stage of the installation. With security settings in MacOS you might have trouble opening some R .pkg files; the awkward workaround is to use Control/right/two-finger click on the file in the Finder, then select ‘Open With’ and ‘Installer’ from the menu that appears.
The version of RSwitch.app noted in the question is still available via a link from this page. This is evidently 32-bit as it is disabled on my Mac under OS 10.14.
Related
When we ssh onto this Linux server, it says Welcome to Ubuntu 16.04.7 LTS (GNU/Linux 4.4.0-193-generic x86_64), so this is the type of server we are on.
When we run R to launch R in the server from terminal, and then version, we get:
What is the easiest way to upgrade from version 3.4.4 to version 3.5.3? We don't want to upgrade to v4 or to the latest version quite yet until we ensure no breaking issues with our codebase on R v4, however we would like to make this upgrade to 3.5.3 so we can run an R library that requires 3.5.3+.
How can we do this from the command line on the server here, and after switching from 3.4.4 to 3.5.3 do we then need to re-install all R libraries on the server as well? I'm worried if I start running stuff from the command line and I mess up that I'll break our current R app.
I would be surprised if there is a .deb available for this OS release/R release combination.
This page only offers R 4.1, but as far back as 16.04 LTS
This page offers older R versions, but only back to 18.04 LTS
It's also possible that one of the backports on the Debian packages page would work on your system (it reports that 3.5.3 is available for Debian "jessie", although I have no idea how that lines up with Ubuntu releases).
I guess it's possible that one of those .debs works for your system though ... ? If you do install from .deb, you may have to be careful not to clobber your current version (e.g. using the --instdir argument to dpkg).
Building from source:
download the source tarball for R 3.5.3
untar, ./configure, make, sudo make install (assuming you have all the necessary development tools, system libraries, etc.; you'll have to troubleshoot/install as you go along)
It might be worth ./configure --prefix=/path/to/testdir to put the new version in a completely separate location, just to make extra-sure you don't stomp on your current install. (This would also simplify the library-path stuff below.)
Packages do need to be re-installed when switching major versions (e.g. 3.4.x to 3.5.x); one way to do it is to copy the system library of packages to a new place (adjust library paths as necessary; see R installation and administration manual).
Then, you should be able to update.packages(checkBuilt=TRUE, ask=FALSE) to update everything.
The tricky spots are (1) getting the library paths right (this will depend a bit on how things are set up in your existing installation; (2) it's conceivable that some current versions of packages on CRAN will fail to re-install/re-build under R 3.5.3. devtools::install_version() would help, although you'd have to track down the correct version manually. I recall someone posting about a package that would install an archived version by date, which could save a lot of poking around ...
Recently I've tried to install keras package in R. I ran the following commands:
install.packages("keras") library(keras)
But when I ran is_keras_avalable() I got FALSE.
I was told, that the problem with unsuccessful 'keras' installation may come from the old RStudio version, which is installed on my notebook (I work in RStudio 3.4.0). I was adviced to reinstall RStudio and to get a brand new version.
Could you, please, tell me how to do it? I'd be very pleased if you provide me with the necessary links for installing the latest RStudio version on Windows 8.1.
Thank you for your help.
RStudio is an application (specifically, an Integrated Development Environment, or IDE). This is a common tool for using R, which is a computer language. Much like Microsoft Word is a common tool for writing documents in English (or other languages - and in fact you can use RStudio to write files other languages like RMarkdown, Python, SQL, French, or Swahili.). However, just like you can write English in programs other than Word, you can also write and run R code in programs other than RStudio.
You can find the most recent version on the RStudio website, or you can look in the Help menu and select "Check for updates", which will give you a download link if a newer version is available.
Given the version number you show, 3.4.0, you need to upgrade R (the language), not RStudio (the application). The current RStudio version as I write this is 1.3.*, while the current R version is 4.0.*.
The place you need to go to update R is CRAN - their website has download links for Windows, Mac, and Linux.
I have an R script that was written by someone else that I need to run. This script depends on another library (written by yet another person) that generates an error when the script is run. This all began after I updated my desktop to the newest Mac OSX, and subsequently updated to the newest R (and newer versions of these dependencies). I'm unable to compile this older version due to some compilers errors (error: unsupported directive '.stabs'), so a binary version seems like the easier way to go than to start digging deep into OPC as a novice R programmer. Is there a way to force R to install older versions of a binary library like there is for package managers for languages like Python and Ruby?
So, what I ended up doing that worked fine was rsyncing my old installation from an old computer that had those libraries already installed. Both were Mac OSX, but the older computer was still on the previous OS and R was compatible and the scripts do run now.
Also, I did find that if you don't reinstall R after you upgrade OS X, the installation is still valid, you just have to recreate the sym links or add the binary to your PATH.
I just made the switch from Windows to Ubuntu. In windows I had the possibility to change the R version used in Rstudio IDE with Tools -> Global options -> R versions.
This is not possible in Ubuntu in the same way, indeed the R versions menu does not appear in Ubuntu version of RStudio (why??). Could you help me in finding the good solution for switching among different, already installed versions of R, in Ubuntu?
The switch among different versions is important for satisfying packages modifications and making old scripts working.
I apologize was not a great question, but more of the kind: "please help me, I'm desperate, I've loose all my Windows habs!" ;)
So if anyone like me want to make the switch from Windows to Ubuntu here is how you can compile an older R version and switch between versions using RStudio. As already #Andrie commented out here are some informations, however not complete https://support.rstudio.com/hc/en-us/articles/200486138-Using-Different-Versions-of-R.
You already have the R version provided by Ubuntu Software Center or a more recent version but you need an older version to run an old important script?
First you need to compile the desired R version from source. In Ubuntu updating R to a newer version leave you with one only version (the updated ones) and not two the older and the new like in Win.
Let's go to the shell and install all you need to build R from source
sudo apt-get build-dep r-base
to install all libraries you will need for compiling. (look also here http://cran.us.r-project.org/bin/linux/ubuntu/)
Download the version you need on CRAN
/bin/linux/ubuntu/MyUbuntu(trusty,precise,lucid) The archive you
need is something like:
r-base_TheVersionIWant.orig.tar.gz
Extract it in a directory (maybe ~/R)
then (in the shell) enter the top directory of the unpacked archive
then you can read the INSTALL file, and run configure with the --enable-R-shlib option (otherwise you will not be able once compiled to run it in RStudio)
./configure --enable-R-shlib && make
then following the INSTALL file
make check
make pdf
make info
If all was ok, you can tell R studio where find the bin/R file it needs
export RSTUDIO_WHICH_R= myPahtTo/bin/R
and fire rstudio with
rstudio
You have an RStudio version running the desired R Version.
When you will close the terminal and the rstudio session you will come back to the system default version of R. Then repeat just the last two lines to come back when you want.
How do I install multiple versions of R on a Mac without overwriting the old version? Where are the appropriate places to install them?
The most appropriate place would be in the R.framework directory. I have versions dating back to R 2.7 on this machine. Installing of a new version from the binary installation package will not overwrite earlier versions. This is what dragging the symlink "Current Version" folder gives when I drag-drop it into the current console window:
/Library/Frameworks/R.framework/Versions/Current
It's actually a reference to:
/Library/Frameworks/R.framework/Versions/2.15
(This is where the binary installer from CRAN will put successive versions by default if you just click OK to all the dialog boxes during installation.)