R/std.error.R

Defines functions std.error

Documented in std.error

std.error<-function(x,na.rm) {
 vn<-function(x) return(sum(!is.na(x)))
 dimx<-dim(x)
 if(is.null(dimx)) {
  stderr<-sd(x,na.rm=TRUE)
  vnx<-vn(x)
 }
 else {
  if(is.data.frame(x)) {
   vnx<-unlist(sapply(x,vn))
   stderr<-unlist(sapply(x,sd,na.rm=TRUE))
  }
  else {
   vnx<-unlist(apply(x,2,vn))
   stderr<-unlist(apply(x,2,sd,na.rm=TRUE))
  }
 }
 return(stderr/sqrt(vnx))  
}
plotrix/plotrix documentation built on Feb. 19, 2024, 8:16 a.m.