Dear list members,

I am looping over several spatial data sets with names "11","12","13" etc.  that I want to turn into kmz files, preserving their original names so that the new files have names like "ST.11", "ST.12", "ST.13" etc.
I have created a list of file names "ST.11","ST.12", "ST.13" that I assign the spacetime objects to during the execution of the loop. However I am finding that kml("ST.11"...) yields an error message "unable to find an inherited method for function "kml", for signature "character". However, when I type manually kml(ST.11...) it works and creates the kmz file that I want. My question is : Since kml() does not want a character variable what can I do to create files whose names correspond to my original list of files ? Other than typing the STDIF object manually ?
The code below illustrates what I am trying to do. Apologies if this is not the right forum.

Thanks for any suggestions,

Juliane


listfiles <- list.files()
for(i in 1:length(listfiles)) {
Data <- read.csv(listfiles[i])
Data.sp <- SpatialPoints(cbind(Data$X,Data$Y))
proj4string(Data.sp) = CRS("+proj=longlat +datum=WGS84")
Data.ST <- STIDF(Data.sp, Data$Date, data.frame(Data$ID))
nameslist[i] <- paste("ST",listfiles[i],sep=".")
assign(nameslist[i],Data.ST)
kml(nameslist[i],kmz=TRUE)
}







	[[alternative HTML version deleted]]

