Get latest version of R on linux (Mint)


This thread is just to serve as a marker for future searchers as Dason answered this for me:

sudo apt-key adv --keyserver --recv-keys E084DAB9

sudo sh -c "echo 'deb quantal/' >> /etc/apt/sources.list"
sudo apt-get update
sudo apt-get install r-base r-base-dev


Probably A Mammal
Pretty sure you don't need the shell command part. The double-redirector (">>") says "append to end of file" and you can just echo your output on command.

Just try it yourself

touch test.txt
This will create an empty text file called "test.txt"

echo "I'm the first line" > test.txt
This single redirect will actually destroy and recreate the file we just created. This is another way to create the file, but with content. Touch can be used on an already existing file to update its time stamp.

echo "\nI'm the second line\n" >> test.txt
We now made sure there was a carriage return ("Enter") between the first and second line (otherwise we'd append to the same line), and then we terminate our line. It's good to do that. If this was successful (as it was on my PC), then we should see a text file with two lines as we've entered. So check it.

cat test.txt
This is no different than doing a print statement in R while we've sinked the output to a file location. Echo is the terminal "print" statement to force things to be printed to the standard output. Just like the sink function, the ">>" redirector changes that standard output to the specified location and being double it sets the parameter to append that output to whatever is there. Make sense?

You could also do something like

sudo leafpad /etc/apt/sources.list &
and then edit it manually in leafpad (like Windows "notepad." There's also mousepad, gedit, and a bunch of others that are commonly available on Linux systems). The "&" at the end of the line frees up your terminal so it doesn't get stuck running the application until you close the program.

Also, you can change in that deb statement the CRAN mirror being used. It's a URL so make sure you visit it to know it is correctly locating your mirror and you didn't mess anything up. The space and "quantal/" is declaring a file on that mirror--viz., the folder that is for your version of ubuntu. So if you're using a different version name, you have to pick the right one (and update it if you upgrade your system). Don't know the name? This is why visiting the URL can help! They're all listed right there. For instance, I'm still on precise apparently.


Dason's thoughts on installing 04-19-2017 [from chatbox]:

Submit Avatar 04/19 10:49 Dason: You're much more competent of a user now than you were previously so I think you should be fine to read the following page and follow the instructions to get an up-to-date version of R:
Submit Avatar 04/19 10:49 Dason: Do the "Secure APT" section first then go back to the top to modify your sources and update
Submit Avatar 04/19 10:51 Dason: But the iastate mirror changed its address. That might cause an issue. It's not anymore
Submit Avatar 04/19 10:51 Dason: You'd probably want to choose a different mirror anyways
Submit Avatar 04/19 10:52 Dason: I'd just go with the cloud mirror