R will be used throughout the course. This section describes how to download and install the files required for the computing exercises (e.g., data files) as well as how to install packages for extending R. If you are working in a computer lab during a course it’s possible these files may have already been installed for you.
Download and installation of R packages is generally done within R. The packages can be installed from CRAN by
install.packages("biostat3") install.packages(c("bshazard","rstpm2","Epi","dplyr"))
You can use the library
function to check if an R package is installed (and load it).
library(biostat3) # main package ## some additional packages library(rstpm2) # stpm2(), pstpm2() library(bshazard) # bshazard() library(Epi) # ccwc() library(dplyr) # mutate(), filter(), group_by(), summarise(), %>%
You can also read the data files directly from the web from within R. For example,
library(foreign) colon <- read.dta("http://www.biostat3.net/download/colon.dta")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.