R

Introduction to R Workshop

Packages workshop_packages <-c("ggplot2", "mosaic", "gganimate") install.packages(workshop_packages) library("gganimate") ## Loading required package: ggplot2 library("ggplot2") library("mosaic") ## Loading required package: dplyr ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union ## Loading required package: lattice ## Loading required package: ggformula ## Loading required package: ggstance ## ## Attaching package: 'ggstance' ## The following objects are masked from 'package:ggplot2': ## ## geom_errorbarh, GeomErrorbarh ## ## New to ggformula?

Introduction to R Workshop

Packages workshop_packages <-c("ggplot2", "mosaic", "gganimate") install.packages(workshop_packages) library("gganimate") ## Loading required package: ggplot2 library("ggplot2") library("mosaic") ## Loading required package: dplyr ## ## Attaching package: ‘dplyr’ ## The following objects are masked from ‘package:stats’: ## ## filter, lag ## The following objects are masked from ‘package:base’: ## ## intersect, setdiff, setequal, union ## Loading required package: lattice ## Loading required package: ggformula ## Loading required package: ggstance ## ## Attaching package: ‘ggstance’ ## The following objects are masked from ‘package:ggplot2’: ## ## geom_errorbarh, GeomErrorbarh ## ## New to ggformula?

Degree-One Polynomials

Problem The question that one of my teaching assistants posed was “What is the difference between lm(y ~ x) and lm(y ~ (poly,1)) for linear regression in R?” That is, it is quickly apparent that those commands produce different results, but for the same intention. Here I will try to explore the underlying difference. Disclaimer: I know that the following discussion is incomplete. These are simply notes that I threw together overnight.

Hello R Markdown

R Markdown This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com. You can embed an R code chunk like this: summary(cars) ## speed dist ## Min. : 4.0 Min. : 2.00 ## 1st Qu.:12.0 1st Qu.: 26.00 ## Median :15.0 Median : 36.00 ## Mean :15.4 Mean : 42.98 ## 3rd Qu.