The GNU R programming language is often paired with posit's RStudio Desktop IDE and a suit of libraries (language packages) known as tidyverse (includes dplyr and ggplot2).
You can also find a web interface to Rstudio on rhea (also Remote Access).
Tutorials contains additional resources.
See
To use the panel for images instead of seeing them inlined within .Rmd use the “Chunk output in console” setting, either from the gear dropdown menu or in the yaml front matter. (From Dan & Victoria)
--- editor_options: chunk_output_type: console ---
When adding module residuals back to a dataframe, you need residuals() to return the same length as the input data.frame. use lm(na.action=na.exclude).
For example,
d <- data.frame(x=c(1:4,NA),y=1:5); m <- lm(x~y,d,na.action=na.exclude); nrow(d); # 5 length(m$residuals); # 4 length(residuals(m)) # 5
This avoids the error
Error in `$<-.data.frame`(`*tmp*`, ... replacement has 237 rows, data has 348
If you load MASS after dplyr, select will be MASS::select not dplyr::select and you're likely to encounter hard-to-debug errors about unused arguments
Error in select … : unused arguments
solutions include
dplyr's version, or # load mass before dplyr to have 'select' be from dplyr
library(MASS)
library(dplyr)
# force which select (if MASS was already loaded after dplyr and overwrite the function)
select <- dplyr::select
# or unload MASS
detach("package:MASS", unload=TRUE)
# check to see
environment(select) # if "MASS", you're in for a bad time