{"id":78,"date":"2016-11-10T10:45:29","date_gmt":"2016-11-10T09:45:29","guid":{"rendered":"http:\/\/staff.um.edu.mt\/jebej02\/blog\/?p=78"},"modified":"2016-11-10T10:45:29","modified_gmt":"2016-11-10T09:45:29","slug":"upgrading-r-on-ubuntu","status":"publish","type":"post","link":"https:\/\/bitsilla.com\/blog\/2016\/11\/upgrading-r-on-ubuntu\/","title":{"rendered":"Upgrading R on Ubuntu"},"content":{"rendered":"<p>During our <a href=\"http:\/\/www.um.edu.mt\/clas\/studyunit\/las3004\">DataX<\/a> course, we recently had an issue where installing the tm package had a dependency on the slam package (that&#8217;s Sparse Lightweight Arrays and Matrices for you). This package requires R &gt;3.3.1, which is a shame as I asked students to install 3.2 at the beginning of the course. Don&#8217;t despair; keep calm and upgrade R.<\/p>\n<p><!--more--><\/p>\n<p>First, of all you need to remove your currently installed R. This is easy enough with:<\/p>\n<pre class=\"toolbar:1 lang:default decode:true\">sudo apt-get remove r-base r-base-dev<\/pre>\n<p>Note the use of remove\u00a0instead of purge\u00a0(the latter deletes all conf files associated with R etc.).<\/p>\n<p>Second, you will need to add the latest R repository to your apt sources files. \u00a0You need to find the correct &#8220;codename&#8221;\u00a0(trusty\u00a0for Ubuntu 14.04, xenial for 16.04).<\/p>\n<pre class=\"toolbar:1 wrap:true lang:default decode:true\">sudo sh -c 'echo \"deb http:\/\/cran.rstudio.com\/bin\/linux\/ubuntu xenial\/\" &gt; \/etc\/apt\/sources.list.d\/R.list'<\/pre>\n<p>Third, you need to get the key for this repository and add it to the apt system. \u00a0This is a way how to tell the updater that you trust the above repository.<\/p>\n<pre class=\"toolbar:1 wrap:true lang:default decode:true\">sudo gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9\nsudo gpg -a --export E084DAB9 | sudo apt-key add -<\/pre>\n<p>Fourth, you know need to let apt-get know you have changed the list of places (repositories) you want it to look at (for updates\/new packages).<\/p>\n<pre class=\"toolbar:1 wrap:true lang:default decode:true\">sudo apt-get update<\/pre>\n<p>Fifth, we can now actually install R<\/p>\n<pre class=\"toolbar:1 wrap:true lang:default decode:true\">sudo apt-get install r-base r-base-dev<\/pre>\n<p>Voil\u00e0, you should now have the latest version or R at your disposal!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>During our DataX course, we recently had an issue where installing the tm package had a dependency on the slam package (that&#8217;s Sparse Lightweight Arrays and Matrices for you). This package requires R &gt;3.3.1, which is a shame as I asked students to install 3.2 at the beginning of the course. Don&#8217;t despair; keep calm [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pap6Kd-1g","_links":{"self":[{"href":"https:\/\/bitsilla.com\/blog\/wp-json\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitsilla.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitsilla.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitsilla.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bitsilla.com\/blog\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":0,"href":"https:\/\/bitsilla.com\/blog\/wp-json\/wp\/v2\/posts\/78\/revisions"}],"wp:attachment":[{"href":"https:\/\/bitsilla.com\/blog\/wp-json\/wp\/v2\/media?parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitsilla.com\/blog\/wp-json\/wp\/v2\/categories?post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitsilla.com\/blog\/wp-json\/wp\/v2\/tags?post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}