---
title: "Setup"
output: rmarkdown::html_vignette
description: |
  Getting R and tameDP installed
vignette: >
  %\VignetteIndexEntry{Setup}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

### Introduction

This vignette provides an overview for getting started working with `tameDP`. The first time you setup R or new packages, you can run into some hurdles, but one you have things setup, everything should be smooth sailing.

### Installing R

In order to use `tameDP`, you will need to install R, an open-source statistics package. You can do this on your USAID GFE, by going to Start > Microsoft Endpoint manager > Software Center. Once there, you can select the Application called "R for Windows" and click "Install". If working on a personal machine, you can install R from [CRAN](https://cran.r-project.org/). Select "Download R for Windows" and then "base" and follow the instructions for installing that pop up when you launch the .exe file from your downloads.


### Installing RStudio (OPTIONAL)

R is the underlying software we're using, but the user interface leaves much to be desired. RStudio is also available in Software Center as well. **You do not need RStudio to run `tameDP`**. If you cannot find it in Software Center, you can submit a Help Desk ticket with M/CIO and they will install it for you. If working on a personal machine, you can install RStudio from [this site](https://www.rstudio.com/products/rstudio/download/). Select "Download" for the free version and follow the instructions for installing that pop up when you launch the .exe file from your downloads.

### Installing Package Dependencies

With proprietary programs like Excel, Tableau, or Stata, all of your functions are built into the software. With open-source packages on the other hand, we need to load different libraries or packages that are written by other organization or individuals users. Most of the dependent packages we need will be installed when we install `tameDP`, but we do need to install a few of our custom USAID/OHA packages. Our USAID/OHA packages are hosted on GitHub and rOpenSci rather than CRAN, R's central software repository. As a result, we will need to tell R to first look at the [USAID-OHA-SI 'R Universe'](https://usaid-oha-si.r-universe.dev/builds) and then install any other dependencies from CRAN. Copy and paste the code chunk below to install all the required packages in a clean instance of R. *If your console asks you to install updates, you can skip this by simply hitting return/enter.*

```{r install oha packages, eval=F, echo=T}
 install.packages(c('gagglr', 'glamr', 'gophr', 'grabr'), 
                  repos = c('https://usaid-oha-si.r-universe.dev',
                            'https://cloud.r-project.org'))
```

### Installing tameDP

Our USAID/OHA packages are hosted on GitHub and rOpenSci rather than CRAN, R's central software repository. As a result, we will need to tell R to first look at the USAID-OHA-SI 'R Universe' and then install any other dependencies from CRAN. Copy and paste the code chunk below to install all the required packages in a clean instance of R. *If your console asks you to install updates, you can skip this by simply hitting return/enter.*

```{r install tameDP, eval=F, echo=T}
 install.packages('tameDP', 
                  repos = c('https://usaid-oha-si.r-universe.dev',
                            'https://cloud.r-project.org'))
```

With all the software and packages installed, you're ready to start using `tameDP`.

