RStudio desktop on a Chromebook without Crouton - using new Linux Beta option

Hey - just thought I would share my success with installing RStudio on a chromebook (Pixelbook to be exact). I'm a Physician/Engineer (Practicing research engineer and training Medical Geneticist) and have lurked on here a long time, but registered today to post this for others. I love this pixelbook - I've found workarounds for most things that had me using Windows devices in the past. For most big data/R/Rstudio work I can (and will) use cloud computing and my Pixelbook is great for remote desktop work like that. However...The ONLY downfall is my data science stuff can't be done on the chromebook locally - at least not easily. My wife also uses RStudio in grad school and was strongly discouraged by her Stats professor from using a chromebook for RStudio. She ultimately gave up on the chromebook because she doesn't like to be dependent on a remote desktop to run her scripts/code (all it takes is one slow connection to make remote work tedious).

Anyway - There are a couple previous threads discussing side-loading/installing crouton etc to get linux to run Rstudio on chromebook hardware. My wife was not comfortable with taking our nice laptop computer and doing that. However, I was finally convinced yesterday to try to install it via the new (Beta) Linux feature directly "baked into" the latest Chromebook OS in a container.

It is probably super simple for hardcore Linux folks out there, but I thought I'd do other people a "solid" and post this. For data scientists / students like my wife who have a nice pixelbook but can't run R - they should try this! Pretty fast and simple!

So here's my Halloween good deed for the day:

  1. First, you need to activate the Linux option. Follow the instructions as follows from Google:
    https://support.google.com/chromebook/answer/9145439

  2. Then you need to open up the new terminal with the icon and proceed with the following code:

#First update the beta chromebook Linux "update" and "upgrade" under "sudo" or superuser credentials...By the way this is Debian 9 64-bit Linux when you are choosing packages to install...

sudo apt-get update && sudo apt-get upgrade

#installing basic R package and the development package...there's more options available bt-dubs.
sudo apt-get install r-base r-base-dev

#need to install this next tool "gdebi" to install the downloaded install package..
sudo apt-get install gdebi-core

#need to install wget to actually get the file first
sudo apt-get install wget

#this one library wasn't installed for me ultimately, and I got an error when I ran Rstudio from the command line the first time , so I went back and installed it manually and THEN re-installed Rstudio...
sudo apt-get install libxslt1.1

#get the file - the actual target will definitely change when newer versions come up, I just made sure it matched the version Linux (Debian 9 / 64-bit)...
sudo wget https://download1.rstudio.org/rstudio-xenial-1.1.463-amd64.deb

#installed the keyring (think this was superfluous to be honest, but I did it and am including it just in case...) per https://www.rstudio.com/code-signing/
sudo apt-get install dpkg-sig
gpg --keyserver keys.gnupg.net --recv-keys 3F32EE77E331692F
dpkg-sig --verify rstudio-xenial-1.1.463-amd64.deb

#install Rstudio...
sudo gdebi rstudio-xenial-1.1.463-amd64.deb

#clean it up...
rm rstudio-xenial-1.1.463-amd64.deb

#UPDATE:  Needed to add write permissions to the R folders as follows:
sudo chmod -R 777 /usr/lib/R
sudo chmod -R 777 /usr/share/R

  1. I out of voodoo Halloween superstition shut down the pixelbook and restarted it before attempting to use R studio. So far working great! Good luck grad students with chromebooks!

  2. Few things I've figure out: In RStudio menu tools>global settings>appearance I had to change font to DejaVu Sans Mono(space) as the default courier font isn't installed and will cause cursor problems. Personally I went with dark background to save chromebook battery life and zoomed font size to 175% to be more reasonably sized/consistent with the Pixel resolution. YMMV.

  3. Edited the above code to add some read/write permissions to the R folders giving some grief in the program.

PS - Mad props to my older brother Ulysses for helping me figure this out!

8 Likes

Glad to hear it's working out for you, @GracilisMuscle! I ended up going the Windows route for my laptop purchase this year, but I'm endlessly interested to see how people make it work with Chromebooks :smiley:

Thanks, @rensa - so far so good. I upgraded to the latest version of R overnight in the linux container and have been playing around with some BioConductor datasets it with no hard limitations so far. I feel confident recommending this to stats students who have a chromebook but don't have the money to invest in another laptop etc, as I don't see anything thus far being a limitation for intro coursework level.

2 Likes

Hey, I'm having issues with the installation. I've installed R and it works from the terminal, but Rstudio is giving me a hard time. When I open it, I just get a blank screen with menus that don't work. Did you have this issue?
Any help would be appreciated.

@tjt28165 Sorry for the delayed response! I had an issue if I didn't choose the correct package for rstudio. What type of chromebook are you using? I mentioned briefly that I am using a Pixelbook - perhaps this is the issue?

This was awesome and worked perfectly! Thank you for posting.

quick question for you. When I get to the line #clean it up it asks
rm: remove write-protected regular file 'rstudio-xenial-1.1.463-amd64.deb' ?
What do I enter?

I'm having problems trying to get RStudio to run. have you had any trouble installing it or had any storage issues because of the size of the software?

@OverseerJ I installed Rstudio on my Pixelbook core i5 w/ 8GB RAM. It runs smoothly for the most part. I installed via Anaconda Navigator in a dedicated rstudio conda environment. Being a newbie, Conda has compensated greatly for my lack of familiarity with Rstudio packages and interdependencies.

However, I ran into a glitch trying to run the following code. Would others on this thread mind trying it on chromebooks? The summary command crashes rstudio every attempt. I cleared as much RAM as possible (approx 3 or 4 GB), but it still crashes. See the code below. Also, here is a link to dja.csv:
https://raw.githubusercontent.com/TaddyLab/BDS/master/examples/dja.csv

dja <- read.csv("dja.csv")$DJ
n <- 1979
plot(dja, type="l", col=4, xlab="day", ylab="DJA")
ARdj <- glm(dja[2:n] ~ dja[1:(n-1)])
summary(ARdj <- glm(dja[2:n] ~ dja[1:(n-1)]))
returns <- (dja[2:n]-dja[1:(n-1)])/dja[1:(n-1)]
plot(returns, type="l", col=3, xlab="day", ylab="DJA Return")
summary( glm(returns[2:n] ~ returns[1:(n-1)]) )