Skip to content

Instantly share code, notes, and snippets.

@ranamahmud
Last active June 1, 2018 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ranamahmud/f1c48971c07b05df53813e142fc2e063 to your computer and use it in GitHub Desktop.
Save ranamahmud/f1c48971c07b05df53813e142fc2e063 to your computer and use it in GitHub Desktop.
# Author: Md Rana Mahmud
## ------------------------------------------------------------------------
x <- c(1,2,3,4,5,6,7,8,9,10)
mean(X)
## ------------------------------------------------------------------------
data(iris)
names(iris)
mean(iris$Sepal.Length)
## ------------------------------------------------------------------------
x.miss <- c(1,2,3,NA,5,6,NA,7,NA,9,10)
mean(x.miss)
## ------------------------------------------------------------------------
mean(x.miss, na.rm = TRUE)
## ------------------------------------------------------------------------
mean(iris$Sepal.Length, trim = 0.20)
## ------------------------------------------------------------------------
true.false <- c(TRUE , TRUE ,TRUE , TRUE ,TRUE ,FALSE ,FALSE ,FALSE ,
FALSE ,FALSE, FALSE,FALSE ,FALSE, FALSE ,FALSE)
table(true.false)
## ------------------------------------------------------------------------
mean(true.false)
## ------------------------------------------------------------------------
mean(iris$Species)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment