[R]  calculation problem when export and import data
    aegea 
    gcheer3 at gmail.com
       
    Thu Dec  3 00:36:35 CET 2009
    
    
  
Hello,
I have a question on export and import data. Thank you for any suggestions.
data 'simul' is generated as follows:
N     <- 20                    
n     <- N/2
nsets <- 10
simul <- matrix(0,nsets,N)
th    <- c(0,1, 1)
for(i in 1:nsets){
    simul[i,] <- rnorm(N,mean= rep(th[1:2],N/2),sd=th[3])
}
I exported data as follows:
write.table(simul, file="D:\\test.txt", row.names=F, col.names=F)
When I want to use this data, I imported as follows:
a=read.table("D:\\test.txt")
So far, it works well. When I deal with data, I need use each row to do
calculations:
for(rep in 1:nsets){
y   <- a[rep,]
b<-c(mean(y)+3, mean(y)-4) # cannot calculate mean(y), the mean of this row
m<-sd(y)   # also cannot calculate sd(y)
}
I need a lot of calculation based on y, but after I imported data, R comes
error on it. 
Could you please give me some suggestions?
-- 
View this message in context: http://n4.nabble.com/calculation-problem-when-export-and-import-data-tp947250p947250.html
Sent from the R help mailing list archive at Nabble.com.
    
    
More information about the R-help
mailing list