# example vector
x <- 1:20
se(x)
sd(x)/sqrt(length(x)) ## matches
# all return NA if missing values are not removed
x2 <- c(x,NA)
sd(x2)/sqrt(length(x2))
# Better if missing values are removed
se(x2) ## Default behavior
sd(x2,na.rm=TRUE)/sqrt(length(x2[complete.cases(x2)])) ## Matches
se(x2,na.rm=FALSE) ## Result from not removing NAs
Run the code above in your browser using DataLab