On Dec 4, 2009, at 1:27 PM, Gray Calhoun wrote:
Hi Muhammad,
Load the data from all of the files into an array (probably using a
for loop), then call apply on the resulting array: ie
I like that idea a lot and it does not need an explicit loop:
apply( array(c(File1, File2, File3), dim=c(3,3
Hi Muhammad,
Load the data from all of the files into an array (probably using a
for loop), then call apply on the resulting array: ie
## replace the first line with code to load your data
> rr <- array(c(rep(1:3,3), rep(4:6,3), rep(7:9,3)), c(3,3,3))
> apply(rr, c(1,2), sd)
[,1] [,2] [,3]
Muhammad -
Here's one way:
files = c('File1','File2','File3')
themats = lapply(files,read.table)
ans = matrix(0,3,3)
for(i in 1:3)for(j in 1:3)ans[i,j] = sd(sapply(themats,function(x)x[i,j]))
Here's another
files = c('File1','File2','File3')
themats = lapply(files,read.table)
ans =
outer
3 matches
Mail list logo