R code snippets

R code snippets

Tags
Code
Created
Dec 29, 2020 7:46 AM

Initialize an empty vector and add things to it

vec <- numeric(0)
vec <- c(vec, i)

Replace values of a vector following a condition with something else

vec[is.na(vec)] <- a

Disable scientific notation in R

options(scipen = 999)