[R] listing array after loop

uday uday_143_4u at hotmail.com
Fri Feb 24 18:48:16 CET 2012


I want to create r object from my data set.
I have several data files  and I would like to read individual parameter
from file and save all 10 files parameter in a single array 
e.g 
setwd("/temp/")
file_s <- list.files(path = ".", pattern = "0b.was", all.files = FALSE,
                    full.names = FALSE, recursive = FALSE, ignore.case =
FALSE)
  lat       <- NULL
  lon      <- NULL
  ch4        <- NULL
for ( i in 1:10) { 
          data            <-   read.table(file_s[i],header=TRUE,skip=55 ) 
          lat[i]           =     data[,7] # latitude
          temp.lon  = data[,8] # longitude
# the longitude data is in 360 degree format need to convert to -180 to 180
          lon[i]         =  ((temp.lon+180) %% 360 ) - 180 
          ch4[i]        =  data[,45] # ch4
}

save (lat,lon,ch4, file="myData.RData"")

but some how it does not work . 

How to list all data in single array after loop .




--
View this message in context: http://r.789695.n4.nabble.com/listing-array-after-loop-tp4418081p4418081.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list