---
title: "Installing Packages from Neuroconductor"
author: "John Muschelli"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Installing Packages from Neuroconductor}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---


# Installing Neuroconductor Packages 

[Install and start the latest release version of R](#installing-and-starting-r).  Although the installer will try to download and install `devtools`, there may be some system requirements for `devtools` that you may need before going forward. 

Then, you can install a package using the following command:

```{r, eval = FALSE}
## try http:// if https:// URLs are supported
source("https://neuroconductor.org/neurocLite.R")
neuro_install("PACKAGE")
```
where `PACKAGE` is the name of the package you'd like to install, such as `fslr`.  For example, if we want to install `neurohcp` and `fslr` we can run:
```{r eval = FALSE}
source("https://neuroconductor.org/neurocLite.R")
neuro_install(c("fslr", "neurohcp"))
```
### `neurocLite`: an alias for `neuroc_install`

As Bioconductor uses the `biocLite` function to install packages, we have created a duplicate of `neuro_install`, called `neurocLite`, for ease of use for those users accustomed to Bioconductor.  The same command could have been executed as follows:
```{r eval = FALSE}
source("https://neuroconductor.org/neurocLite.R")
neurocLite(c("fslr", "neurohcp"))
```

### Installing the `neurocInstall` package

The `neurocInstall` package contains the `neurocLite`/`neuro_install` functions, as well as others relevant for Neuroconductor.  You can install the package as follows:

```{r eval = FALSE}
source("https://neuroconductor.org/neurocLite.R")
neuro_install("neurocInstall")
```

After installation, you can use `neurocInstall::neuroc_install()` to install packages without having to source the URL above.

## Installing Neuroconductor Packages without upgrading dependencies

The `neurocLite`/`neuro_install` functions depend on `devtools::install_github`, which will upgrade dependencies by default, which is recommended.  If you would like to install a package, but not upgrade the dependencies (missing dependencies will still be installed), you can set the `upgrade_dependencies` argument to `FALSE`:

```{r, eval = FALSE}
neurocLite(c("fslr", "neurohcp"), upgrade_dependencies = FALSE)
```

# Installing and starting R 

1.  Download the most recent version of R from [https://cran.r-project.org/](https://cran.r-project.org/). There are detailed instructions on the R website as well as the specific R installation for the platform you are using, typically Linux, OSX, and Windows.

2.  Start R; we recommend using R through [RStudio](https://www.rstudio.com/).  You can start R using RStudio (Windows, OSX, Linux), typing "R" at in a terminal (Linux or OSX), or using the R application either by double-clicking on the R application (Windows and OSX).

3.  For learning R, there are many resources such as [Try-R at codeschool](http://tryr.codeschool.com/) and [DataCamp](https://www.datacamp.com/getting-started?step=2&track=r).


# Packages not available on Neuroconductor

If a package is not in the Neuroconductor [list of packages ](https://neuroconductor.org/list-packages), then it is not located on the [Neuroconductor Github](https://github.com/neuroconductor?tab=repositories).  Therefore, when installing, you'll get the following error:

```
Error in neuro_install(...) : 
  Package(s) PACKAGE_TRIED_TO_INSTALL are not in neuroconductor
```

Once a package is located on the list of packages, then it will be available to install. 

