[R-sig-Geo] Trying to read a list of maps using readRAST6

Thomas Adams Thomas.Adams at noaa.gov
Wed Apr 21 20:15:39 CEST 2010


All:

With sp & spgrass6 I have no problem reading a list of maps with 
readRAST6 when I do the following:

data<-readRAST6(c("map1","map2","map3",…))

however, I need to do this dynamically within a script, for example:

 > inputfile<-Sys.getenv("R_INPUT_FILE")
 > map_list<-scan(inputfile,list(""))

Read 21 records

 > map_list

[[1]]
[1] "sref_em.t09z.pgrb212.ctl" "sref_em.t09z.pgrb212.n1"
[3] "sref_em.t09z.pgrb212.n2" "sref_em.t09z.pgrb212.p1"
[5] "sref_em.t09z.pgrb212.p2" "sref_eta.t09z.pgrb212.ctl1"
[7] "sref_eta.t09z.pgrb212.ctl2" "sref_eta.t09z.pgrb212.n1"
[9] "sref_eta.t09z.pgrb212.n2" "sref_eta.t09z.pgrb212.p1"
[11] "sref_eta.t09z.pgrb212.p2" "sref_nmm.t09z.pgrb212.ctl"
[13] "sref_nmm.t09z.pgrb212.n1" "sref_nmm.t09z.pgrb212.n2"
[15] "sref_nmm.t09z.pgrb212.p1" "sref_nmm.t09z.pgrb212.p2"
[17] "sref_rsm.t09z.pgrb212.ctl1" "sref_rsm.t09z.pgrb212.n1"
[19] "sref_rsm.t09z.pgrb212.n2" "sref_rsm.t09z.pgrb212.p1"
[21] "sref_rsm.t09z.pgrb212.p2"


data<-readRAST6(map_list)
spplot(data,…)

What happens is that "map_list" is treated literally, not as: 
data<-readRAST6(c("map1","map2","map3",…)) which works. I have tried a 
number of things, such as:

data<-readRAST6(as.list(map_list))
data<-readRAST6(c(map_list))
data<-readRAST6(as.vector(map_list))
data<-readRAST6(eval(map_list))

How do I do this?

Regards,
Tom

-- 
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL:	thomas.adams at noaa.gov

VOICE:	937-383-0528
FAX:	937-383-0033



More information about the R-sig-Geo mailing list