Installing RStudio with ggplot2 in Ubuntu Trusty
Let's start by adding the necessary repositiory and the key. So that, we'll write the next line into the file sudo vim /etc/apt/sources.list:
deb http://cran.es.r-project.org/bin/linux/ubuntu trusty
And we'll execute the following comands:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt-get update
Once we have updated the correspondent packages, we'll install R-project:
sudo apt-get install r-base
Now, it's time to get RStudio from its own website and install it:
sudo dpkg -i rstudio-0.99.489-amd64.deb
So far, we have our IDE capable of running R commands, however we are trying to plot charts with the tool ggplot2. Hence, we open RStudio and go to:
Tools > Install Packages
If you don't have a Rstudio working directory, the app will ask you to create one in HOME.
Look for "ggplot2" with its dependencies as shown in the picture.
Don't get on your nerves, it takes a while...
When it finish, we can test the whole installation by running this simple code :
a = as.data.frame(matrix(c(51,43,22,92,28,21,68,22,9,23), ncol=2, byrow=TRUE))
ggplot(a, aes(x=a[,1], y=a[,2])) + geom_point()
--------------- REFERENCES ----------------