Uninstalling R and some packages (CRAN, devtools, and GitHub)

7,796

In your procedure above you installed the shiny, devtools, and shinyjs packages for R from the CRAN repository. To remove them:

sudo su - -c "R -e \"remove.packages(c('devtools', 'shiny', 'shinyjs'))\""

Note that RStudio requires R be installed on your system, so if you want to use the RStudio IDE then you likely don't want to uninstall r-base.

However, if you do want to remove R, along with the additional apt packages you added, and also remove the repository & key:

sudo apt-get purge r-base libcurl4-gnutls-dev libxml2-dev libssl-dev
sudo apt-key del E084DAB9

* Note that in general, you do not need to use sudo to install R packages. So if you decide to reinstall R in the future, you you can simply run install.packages('packageName') from your R session.

Share:
7,796

Related videos on Youtube

Jayaguru-Shishya
Author by

Jayaguru-Shishya

Updated on September 18, 2022

Comments

  • Jayaguru-Shishya
    Jayaguru-Shishya over 1 year

    I've been on Linux Ubuntu 16.04 LTS for a few weeks now, and I just went through a multi-step installation process of R. The process also included packages, such as CRAN, devtools, and GitHub.

    However, I realized that it was not quite what I was looking for, and I'd like to unistall the software now. The problem is, I have no idea how to. I think I'll move to R Studio, as it has a graphical interface.

    Anyway, these are the commands I utilised in the installation process:

    Setting up apt

    sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list'
    gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
    gpg -a --export E084DAB9 | sudo apt-key add -
    

    Installing R

    sudo apt-get update
    sudo apt-get -y install r-base
    

    Installing R packages from CRAN

    sudo su - -c "R -e \"install.packages('shiny', repos = 'http://cran.rstudio.com/')\""
    

    Installing devtools package

    sudo apt-get -y install libcurl4-gnutls-dev libxml2-dev libssl-dev
    sudo su - -c "R -e \"install.packages('devtools', repos='http://cran.rstudio.com/')\""
    

    Installing R Packages from GitHub

    sudo su - -c "R -e \"devtools::install_github('daattali/shinyjs')\""
    

    I hope you can help me! I am just learning Linux commandline, and a more complex software removal like this would serve as a great lesson! Thanks!

    • John Orion
      John Orion almost 8 years
      i would probably just try the commands in reverse or just uninstall R itself the other stuff will probably get removed other than the dev tools which some probably will and the ones left over wont hurt you any. You could try the R uninstall stuff like the last command using this instead and see if it works sudo su - -c "R -e \"devtools::remove_github('daattali/shinyjs')\"" but if you did sudo apt-get remove r-base that should get rid of most of it and as I said .. the left overs wont do you any harm and may actually have a chance to usesudo apt-get autoremove to get rid anything extra
  • Jayaguru-Shishya
    Jayaguru-Shishya almost 8 years
    Oooh, I didn't know that RStudio acutally requires R! I thought they are two completely different applications! Silly me! In that case, I don't want to remove R anymore! Thanks!