An intro to R
This document is a quick introduction to basic R. Audience would be users who are not familiar with R.
- Dot “.” is valid in a variable name or a function (e.g. variable
- Syntax for formula: Below is an example formula:
formula <- FD ~ age + sex
As you can see even though we did not define variable “FD”,“age” or “sex”, it’s a valid formula. Left hand side of “~” is dependent variable (y, or response), and right hand side includes the independent variables / covariates.
You may want to manipulate the data.frame
phenotypes before passing it to
ModelArray.lm() etc functions for model fitting. Examples like de-mean and rescale covariates. R package
dplyr is useful and easy to use for manipulation.