Skip to content

Instantly share code, notes, and snippets.

@krasnobaev
Created October 17, 2014 22:32
Show Gist options
  • Save krasnobaev/2e58621bb1f1d48af65f to your computer and use it in GitHub Desktop.
Save krasnobaev/2e58621bb1f1d48af65f to your computer and use it in GitHub Desktop.
R handies
data[47]
table(is.na(data))
mean(data, na.rm=TRUE)
mean(data.R[which(data > 31 & data > 90)])
mean(data[data == 6])
max(data[data == 5], na.rm=TRUE)
by(iris$Sepal.Length, iris$Species == "virginica", mean)[2]
apply(iris[, 1:4], 2, mean)
with(mtcars, tapply(mpg, cyl, mean))
tapply(mtcars$mpg, mtcars$cyl, mean)
by(mtcars, mtcars, mean)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment