Just to play a little: mystats<- function(x) { xvalid<-x[!is.na(x)] XNtotal<-length(x) XNnull<-length(xvalid) XNnotNull<-XNtotal-XNnull Xmean<-mean(xvalid) Xmedian<-median(xvalid) Xsd<-sd(xvalid) Xrange<-range(xvalid) my.results<-cbind(XNtotal, XNnull, XNnotNull, Xmean, Xmedian, Xsd, Xmin=Xrange[1], Xmax=Xrange[2]) return (my.results) }
x<-c(NA,rnorm(10),NA) #thanks Jorge Belez mystats(x) [ ]s miltinho On Mon, Feb 9, 2009 at 8:46 PM, Jorge Ivan Velez <jorgeivanve...@gmail.com>wrote: > Dear SY, > > Also take a look at basicStats in the fBasics package. > > # fBasics package > install.packages('fBasics') > require(fBasics) > > # For reproducibility > set.seed(123) > > # Some data > x<-c(NA,rnorm(10),NA) > basicStats(x) > > > HTH, > > Jorge > > > On Mon, Feb 9, 2009 at 6:04 PM, phoebe kong <sityeek...@gmail.com> wrote: > > > Hi all, > > > > I'm wondering if there is a function that can return summary statistics: > > N=total number of observation, # missing, mean, median, range, standard > > deviation. > > > > As I know, summary() returns some of info I've mentioned above. > > > > Thanks, > > SY > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.