Skip to content

Commit

Permalink
updating R package install page
Browse files Browse the repository at this point in the history
  • Loading branch information
AstrobioMike committed Oct 2, 2019
1 parent a53aa0f commit f3cb1c6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
30 changes: 15 additions & 15 deletions Gemfile.lock
Expand Up @@ -6,8 +6,8 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
coffee-script (2.4.1)
coffee-script-source
execjs
Expand All @@ -25,12 +25,12 @@ GEM
ffi (>= 1.3.0)
eventmachine (1.2.7)
execjs (2.7.0)
faraday (0.15.4)
faraday (0.16.2)
multipart-post (>= 1.2, < 3)
ffi (1.11.1)
forwardable-extended (2.6.0)
gemoji (3.0.1)
github-pages (198)
github-pages (200)
activesupport (= 4.2.11.1)
github-pages-health-check (= 1.16.1)
jekyll (= 3.8.5)
Expand All @@ -47,7 +47,7 @@ GEM
jekyll-readme-index (= 0.2.0)
jekyll-redirect-from (= 0.14.0)
jekyll-relative-links (= 0.6.0)
jekyll-remote-theme (= 0.3.1)
jekyll-remote-theme (= 0.4.0)
jekyll-sass-converter (= 1.5.2)
jekyll-seo-tag (= 2.5.0)
jekyll-sitemap (= 1.2.0)
Expand All @@ -72,7 +72,7 @@ GEM
listen (= 3.1.5)
mercenary (~> 0.3)
minima (= 2.5.0)
nokogiri (>= 1.8.5, < 2.0)
nokogiri (>= 1.10.4, < 2.0)
rouge (= 2.2.1)
terminal-table (~> 1.4)
github-pages-health-check (1.16.1)
Expand All @@ -84,11 +84,10 @@ GEM
html-pipeline (2.12.0)
activesupport (>= 2)
nokogiri (>= 1.4)
html-proofer (3.11.1)
activesupport (>= 4.2, < 6.0)
html-proofer (3.13.0)
addressable (~> 2.3)
mercenary (~> 0.3.2)
nokogiri (~> 1.9)
mercenary (~> 0.3)
nokogiri (~> 1.10)
parallel (~> 1.3)
rainbow (~> 3.0)
typhoeus (~> 1.3)
Expand Down Expand Up @@ -142,7 +141,8 @@ GEM
jekyll (~> 3.3)
jekyll-relative-links (0.6.0)
jekyll (~> 3.3)
jekyll-remote-theme (0.3.1)
jekyll-remote-theme (0.4.0)
addressable (~> 2.0)
jekyll (~> 3.5)
rubyzip (>= 1.2.1, < 3.0)
jekyll-sass-converter (1.5.2)
Expand Down Expand Up @@ -212,7 +212,7 @@ GEM
jekyll (~> 3.5)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.11.3)
minitest (5.12.2)
multipart-post (2.1.1)
nokogiri (1.10.4)
mini_portile2 (~> 2.4.0)
Expand All @@ -223,15 +223,15 @@ GEM
forwardable-extended (~> 2.6)
public_suffix (3.1.1)
rainbow (3.0.0)
rake (12.3.3)
rake (13.0.0)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
rouge (2.2.1)
ruby-enum (0.7.2)
i18n
ruby_dep (1.5.0)
rubyzip (1.2.3)
rubyzip (2.0.0)
safe_yaml (1.0.5)
sass (3.7.4)
sass-listen (~> 4.0.0)
Expand All @@ -255,7 +255,7 @@ PLATFORMS
ruby

DEPENDENCIES
github-pages (= 198)
github-pages (= 200)
html-proofer
jekyll-feed (~> 0.6)
rake
Expand Down
34 changes: 17 additions & 17 deletions R/installing_packages.md
Expand Up @@ -9,7 +9,7 @@ permalink: /R/installing_packages

{% include _side_tab_R.html %}

Part of what makes R so valuable is that there is an enormous community of people developing software packages for it. People share bundles of code that perform specific tasks through what are known as "packages". Packages are typically maintained at the [Comprehensive R Archive Network (CRAN)](https://cran.r-project.org/web/packages/){:target="_blank"} and/or at [Bioconductor](https://www.bioconductor.org/){:target="_blank"}. To use a package, you simply need to install it and then load it. Here we'll cover the 3 main ways for installing packages.
Part of what makes R so valuable is that there is an enormous community of people developing software packages for it. People share bundles of code that perform specific tasks through what are known as "packages". Packages are typically maintained at the [Comprehensive R Archive Network (CRAN)](https://cran.r-project.org/web/packages/){:target="_blank"} and/or at [Bioconductor](https://www.bioconductor.org/){:target="_blank"}. To use a package, we simply need to install it and then load it. Here we'll cover the 3 main ways for installing packages.
<br>
<br>

Expand All @@ -18,56 +18,56 @@ Part of what makes R so valuable is that there is an enormous community of peopl
<br>

## install.packages()
Most often, you will be able to install packages with the `install.packages()` function. For example, if you want to install the [ggplot2 package](https://cran.r-project.org/web/packages/ggplot2/index.html){:target="_blank"}, you would simply enter:
Often, we will be able to install packages with the `install.packages()` function. For example, if we want to install the [ggplot2 package](https://cran.r-project.org/web/packages/ggplot2/index.html){:target="_blank"}, we would simply enter:

```R
install.packages("ggplot2")
```

And you'll get some info printed to your screen such as this:
And we get some info printed to our screen such as this:

<center><img src="../images/ggplot2_install.png"></center>
<br>
And all is well with the world and you are ready to load the package with `library("ggplot2")`, at which point you're ready to rock.
And all is well with the world and we are ready to load the package with `library("ggplot2")`, at which point we're ready to rock.

But occasionally when using `install.packages()` you will get a message like the following:
But occasionally when using `install.packages()` we will get a message like the following:

<center><img src="../images/phyloseq_install_packages.png"></center>
<br>
But do not despair! This is usually just a consequence of the package not having been updated to install this particular way, and you can almost always get around it by installing from bioconductor. When you do run into this, you should head right on over to google and search with terms for the package name and bioconductor, and you'll most likely find a way to install with `biocLite()`.
But do not despair! This is usually just a consequence of the package not being maintained to be installable this particular way, and we can almost always get around it by installing from [Bioconductor](https://bioconductor.org/){target="_blank"} directly. When we do run into this, we should head right on over to google and search with terms for the package name and bioconductor, and we'll most likely find a way to install with `BiocManager::install()`.
<br>

---
<br>

## biocLite()
For example, searching for ["phyloseq bioconductor"](https://www.google.com/search?q=bioconductor+phyloseq+R&oq=bioconductor+phyloseq+R&aqs=chrome..69i57j69i60.5566j0j7&sourceid=chrome&ie=UTF-8) returns the [bioconductor homepage of the *phyloseq* package](http://bioconductor.org/packages/release/bioc/html/phyloseq.html){:target="_blank"} as the top hit. And when you head over there, there are directions to install via bioconductor:
## BiocManager::install()
BiocManager handles all of the packages hosted on [Bioconductor](https://bioconductor.org/){target="_blank"}. And is my usual next attempt if `install.packages()` does not work. If we don't have it yet, this can be installed with:

```R
source("https://bioconductor.org/biocLite.R")
biocLite("phyloseq")
install.packages("BiocManager")
```

And sure enough that seems to work just swell:
Then, for example, searching for ["phyloseq bioconductor"](https://www.google.com/search?q=bioconductor+phyloseq+R&oq=bioconductor+phyloseq+R&aqs=chrome..69i57j69i60.5566j0j7&sourceid=chrome&ie=UTF-8) returns the [bioconductor homepage of the *phyloseq* package](http://bioconductor.org/packages/release/bioc/html/phyloseq.html){:target="_blank"} as the top hit. And when we head over there, there are directions to install directly from Bioconductor:

<center><img src="../images/phyloseq_bioconductor_install_run.png"></center>
<br>
```R
BiocManager::install("phyloseq")
```

And again, after installing, you'd need to load the library in order to access the functions it contains: `library("phyloseq")`.
And again, after installing, we'd need to load the library in order to access the functions it contains: `library("phyloseq")`.
<br>

---
<br>

## install_github()
Occasionally bioconductor may also not workout. At that point I usually turn to searching for the package on github as it may be hosted there, and if so it usually contains instructions for how to install it via devtools and the `install_github()` function.
Occasionally Bioconductor may also not workout. At that point I usually turn to searching for the package on github as it may be hosted there, and if so it usually contains instructions for how to install it via devtools and the `install_github()` function.

For example, a little googlation for ["tidyr github"](https://www.google.com/search?ei=6BwBWqfgLca6jwOwsIXACg&q=tidyr+github&oq=tidyr+github&gs_l=psy-ab.3..0.1251.3680.0.3814.18.15.3.0.0.0.141.1174.11j3.14.0....0...1.1.64.psy-ab..1.17.1182...0i67k1j0i131k1j0i10k1j0i22i10i30k1.0.Xit6NDyEZS0) returns as the top hit the [tidyr package github page](https://github.com/tidyverse/tidyr){:target="_blank"}, and if you scroll down a little bit there are installation instructions that include how to install.
For example, a little googlation for ["tidyr github"](https://www.google.com/search?ei=6BwBWqfgLca6jwOwsIXACg&q=tidyr+github&oq=tidyr+github&gs_l=psy-ab.3..0.1251.3680.0.3814.18.15.3.0.0.0.141.1174.11j3.14.0....0...1.1.64.psy-ab..1.17.1182...0i67k1j0i131k1j0i10k1j0i22i10i30k1.0.Xit6NDyEZS0) returns as the top hit the [tidyr package github page](https://github.com/tidyverse/tidyr){:target="_blank"}, and if we scroll down a little bit there are installation instructions that include how to install.

```R
install.packages("devtools")
devtools::install_github("tidyverse/tidyr")

# and after that finishes up, you'd just need to load the library for use
# and after that finishes up, we just need to load the library for use
library("tidyr")
```

0 comments on commit f3cb1c6

Please sign in to comment.