## HEADER ##### ## What: R advent calendar ## https://kiirstio.wixsite.com/kowen/post/the-25-days-of-christmas-an-r-advent-calendar ## When: HARUG! 2019.12.11 ## Who: Last edited by Ed #### ## CONTENTS #### ## Day 01 D/L R and RStudio ## Day 02 RStudio layout ## Day 03 setwd() ## Day 04 simple calc ## Day 05 Help in R ## Day 06 Vectors ## adventofcode 01 ## Day 01 D/L R and RStudio #### # download R and RStudio ::: COMPLETE ## Day 02 RStudio layout #### # Checkout Rstudio layout ::: COMPLETE ## Day 03 setwd() #### # set wd Ed HA PC setwd("D:/Dropbox/WORK/__Harper Adams stuff/_HARUG HA R Users Group/2019.12.11 HARUG R motivator/R advent cal") getwd() ## Day 04 Simple calc #### 2+5 2^5 67^8 log(25) sqrt(25) abs(-25) ## Day 05 help() in R #### ?sqrt # yep ## Day 06 Vectors numbers <- c(1,2,3,4,5) numbers # watch out for copy and paste! hi <-c("Happy holidays, I hope you have a wonderful day!") hi sum(numbers) ?c ## adventofcode 01 #### # my personal input vector # take its mass, divide by three, round down, and subtract 2 ?floor #test floor(1969/3)-2 #654 source("mass.R") fuel <- floor(mass/3)-2 sum(fuel) #3553700