Displaying 1 result from an estimated 1 matches for "createsummary".
2001 Aug 13
1
Processing all *.dat worked. Thanks
...ants a regular expression, and *.dat was
grabbing all files with .dat in them, not ones ending in .dat. This
code creates a *.dat.summary file with the mean and std. deviation. of
the numeric variables for every *.dat file in the current directory.
myDat<-list.files(pattern="*.dat$")
createSummary <-function(dsName){
data<-read.table(dsName,header=T,as.is = TRUE)
indices<-1:dim(data)[2]
indices<-na.omit(ifelse(indices*sapply(data,is.numeric),indices,NA))
mean<-sapply(data[,indices],mean)
sd<-sapply(data[,indices],sd)
newOutput<-rbind(mean,sd)
newOutput<-...