Every programming language has them. Those oddball situations where you have an apparently simple task which well… doesn’t fit neatly into the obvious answers. Knowing the right R function to use or a quick workaround can spell the difference between spending hours on Stack Overflow and quickly moving onto the next step. We’re making a list of some little things that can really simplify your life here.
Bookmark us and check back regularly.
Functions of interest
Statistics
Cleaning Up Data
- complete.cases() – identify entire rows which contain at least one NA values
- is.na() – check for missing values
- na.omit – quick way to drop rows with missing values
- Rounding in R
Sampling
Statistical Distributions
- rpois function – Possion Distribution
- rnorm – Normal Distribution
- runif – Uniform distribution
- rbinom – Binomial distribution
- rexp – Exponential distribution
- set.seed in R – set seed of a random generator
File System Manipulation
Environment Management
Data Manipulation
Writing Good Code
- Rename Columns in R – hint: make them easy to understand