Setup information for using R on your local computer.
These steps redefine the R user packages folder in R to use a “Local” folder within your R user profile, which for me is: C:/Users/EshelO/Local/R/win-library/3.4
.
Relocate your existing R user library folder (which for me was in C:/Users/EshelO/Document/R/win-library/3.4
(if Documents has already been migrated, this would be C:/Users/EshelO/OneDrive - Perkins and Will/Documents) to C:/Users/EshelO/Local/R/win-library
(or per above)
Test the change:
Run .libPaths("C:/Users/EshelO/Local/R/win-library/3.4")
(modifying as necessary) - this is only for your current R session
Run .libPaths()
and you should be able to validate this worked
Run a test require()
and install.packages()
to verify R can both read and install to the new location
require(dplyr)
install.packages("tidycensus")
–>
Git is a version control system, a tool that tracks changes to your code and shares those changes with others. Git is most useful when combined with GitHub, a website that allows you to share your code with the world, solicit improvements via pull requests and track issues. Git + GitHub is the most popular version control system for developers of R packages (thousands of R packages are hosted on GitHub) and many other types of software.
Git and GitHub are generally useful for all software development and data analysis, not just R packages.
To use Git/GitHub with R, you will need to set up a GitHub account and configure RStudio to interface with GitHub. Detailed instructions for this can be found here.
File a help ticket with IT to have Git installed.
- To get an Enterprise P+W account: - Create your own personal github account; recommend setting up using your personal e-mail - Email Joel Register your github username and ask to be added to the Nelsonteam - “Could I request to join the enterprise GitHub account? My username is XXXXX.”
RTools is a collection of development tools that are essential for writing and releasing packages. The latest RTools package can be downloaded from the CRAN website. File a help ticket to have it installed. If everything goes well, you will have a new directory on your computer called C:/Rtools. More detailed information and instructions can be found here.
Create R folder within G: Drive
Folder structure
README.txt
Add shortcuts to P - Analysis
Esther suggests three subfolders:
Start using R Projects?
In R studio go to Tools -> global options –> code –> bottom of page “edit snippets” –> scroll to bottom and paste the below in, change your name in the Author field.
snippet header## ---------------------------
##
## Script name:
##
## Purpose of script:
##
## Project Name:
##
## Project Number:
##
## Author: Esther Needham
##
## Date Created: `r paste(Sys.Date())`
##
## ---------------------------
##
## Notes:
##
##
## ---------------------------
## set working directory here or make sure there is a .Rproj file
## ---------------------------
options(scipen = 6, digits = 4) # view outputs in non-scientific notation
## ---------------------------
## load up the packages we will need: (uncomment as required)
require(tidyverse)
require(sf)
## ---------------------------
## load up functions from other scripts into memory
# source("functions/summarise_data.R") #example
## ---------------------------
This account is accessible to various people (Bryan, Tomoko, Esther, Oren)
You can add it to your email by:
Email is also forwarded to each of the above individuals. Forwarding is set up using a server side rule by logging into Outlook 365 web mail. If others need to be added, this can be done by:
Log into Outlook 365 (this link should take you straight to the account)
Settings icon in upper right of Outlook
Mail settings -> Rules
“Shinyapps Email Forwarding” Rule -> Edit Rule