Re: [R-sig-Geo] Aggregate time series grid data temporally

2012-03-12 Thread Oscar Perpiñán Lamigueiro
senani karunaratne senaw...@yahoo.com writes: Hi Ping, You can read your grid files to R. Recently I  read monthly grid data for time series and they can be stacked in R. Use package Raster for stacking purpose. Code I used is given below setwd (D:\\WORKINGS) # check your data in

[R-sig-Geo] Help: Create several ESRI Shape files in a Loop

2012-03-12 Thread Zia Ahmed
I like to write a r-function to create 100 shape files in a loop.I have three data files. Each file has 100 data fields (like sim1, sim2, sim3sim100) with a unique ID fields (Thana_ID). First I want to create 100 data frame from these files and then merge or join each of this 100 files

Re: [R-sig-Geo] Help: Create several ESRI Shape files in a Loop

2012-03-12 Thread Raphael Saldanha
Hi Zia, There are two methods were you can work: the for statement and the tapply function. First, take a good look on these: ?for and ?tapply You can try something like this: for (i in 1:100) sim-cbind(THANA_ID=thana$THANA_ID, logWAS=was$[,i], logGAs=gas$[,i],logTotal=total$[,i]) sim.shp -

Re: [R-sig-Geo] Help: Create several ESRI Shape files in a Loop

2012-03-12 Thread Roman Luštrik
For constructing sim1:n you could probably use mapply. The second part of inserting the data into your read-in shapefiles could possibly be done using sapply. HTH, Roman On Mon, Mar 12, 2012 at 2:53 PM, Zia Ahmed z...@cornell.edu wrote: I like to write a r-function to create 100 shape files

Re: [R-sig-Geo] Help: Create several ESRI Shape files in a Loop

2012-03-12 Thread Raphael Saldanha
Ops! Take off the $ on this line sim-cbind(THANA_ID=thana$THANA_ID, logWAS=was$[,i], logGAs=gas$[,i],logTotal=total$[,i]) This mus be: sim-cbind(THANA_ID=thana$THANA_ID, logWAS=was[,i], logGAs=gas[,i],logTotal=total[,i]) On Mon, Mar 12, 2012 at 11:13 AM, Raphael Saldanha

Re: [R-sig-Geo] Help: Create several ESRI Shape files in a Loop

2012-03-12 Thread Zia Ahmed
I have tried your code, but it create only one shape file (sim100.shp). Thanks Zia for (i in 1:100) sim-cbind(THANA_ID=thana$THANA_ID, logWAS=was[,i], logGAs=gas[,i],logTotal=total[,i]) sim.shp - thana sim.shp@data - merge(thana@data,sim,by.x=THANA_ID,by.y=THANA_ID, all.x=T, sort=F)

[R-sig-Geo] trouble readOGR

2012-03-12 Thread Thomas Hoffmann
Dear all, I try to import an Mapinfo file to R and get following error message: tmp = readOGR(fi.tab[k],layer=fi[k]) OGR data source with driver: MapInfo File Source: 25545700.TAB, layer: 25545700 with 40401 features and 3 fields Fehler in make.names(fldnms, unique = TRUE) : ungültige

Re: [R-sig-Geo] trouble readOGR

2012-03-12 Thread Barry Rowlingson
On Mon, Mar 12, 2012 at 5:34 PM, Thomas Hoffmann tomte.tume...@gmx.ch wrote: Dear all, I try to import an Mapinfo file to R and get following error message: tmp = readOGR(fi.tab[k],layer=fi[k]) OGR data source with driver: MapInfo File Source: 25545700.TAB, layer: 25545700 with 40401

[R-sig-Geo] apply monte carlo simulation for each cell in a matrix (originally raster)

2012-03-12 Thread Diann Prosser
Hi all, I hope you forgive me for this cross-post. I requested help a few days ago on the general R-help board but haven't received a response. I think that a solution can most likely be answered by someone familiar with working with large spatial datasets. I have raster datasets exported from