[R-sig-Geo] ASCII grids as spatialgridframe

Els Ducheyne educheyne at avia-gis.be
Thu Jul 23 15:12:19 CEST 2009


Thanks all for a speedy replies!

On 23 Jul 2009, at 15:06, mdsumner wrote:

> This should work:
>
> grids[["achan"]]<-achandata[[1]]
> You need to extract the first column from achandata to assign just  
> the data values as a new attribute on grids (which is fine since  
> your two SGDFs share topology). .
>
> Regards, Mike.
>
> ----- Original Message -----
> From: Els Ducheyne <educheyne at avia-gis.be>
> Date: Thursday, July 23, 2009 22:38
> Subject: [R-sig-Geo] ASCII grids as spatialgridframe
> To: r-sig-geo at stat.math.ethz.ch
>
> > Dear all
> > sorry to post this question, but I have been looking across
> > multiple fora and haven't found the answer
> >
> > I am trying to read ascii-grids in R using the shapefile -
> > read.asciigridI have found that this is of class  
> SpatialGridDataFrame
> > I would like to combine this with a set of grids that are
> > already in the workspace but when i use the [[<-option I
> > always get the following error
> > What am I doing wrong? I am not using rgdal, because of a
> > linking error that I cannot seem to overcome - even though the
> > installation of rgdal and all its dependencies didn't yield an erro
> >
> > Thanks for any help!
> >
> >  achandata<-read.asciigrid("achan.asc")
> > > summary(achandata)
> > Object of class SpatialGridDataFrame
> > Coordinates:
> >
> > min    max
> > coords.x1 -2.5 1002.5
> > coords.x2 -2.5  502.5
> > Is projected: NA
> > proj4string : [NA]
> > Number of points: 2
> > Grid attributes:
> >   cellcentre.offset cellsize cells.dim
> > 1                 0        5       201
> > 2                 0        5       101
> > Data attributes:
> >    Min. 1st Qu.  Median    Mean
> > 3rd Qu.    Max.
> >  0.0000  0.0000  0.3000  0.7088
> > 0.9000  6.2000
> > > grids[["achan"]]<-achandata
> > Error: object is not subsettable
> > > summary(grids)
> > Object of class SpatialGridDataFrame
> > Coordinates:
> >
> > min    max
> > coords.x1 -2.5 1002.5
> > coords.x2 -2.5  502.5
> > Is projected: NA
> > proj4string : [NA]
> > Number of points: 2
> > Grid attributes:
> >   cellcentre.offset cellsize cells.dim
> > 1                 0        5       201
> > 2                 0        5       101
> > Data attributes:
> >
> > elev            grad
> >  Min.   :119.8   Min.   :0.0008663
> >  1st Qu.:140.0   1st Qu.:0.0399718
> >  Median :144.0   Median :0.0620299
> >  Mean   :144.3   Mean   :0.0821328
> >  3rd Qu.:150.1   3rd Qu.:0.1129532
> >  Max.   :159.5   Max.   :0.3284767
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo at stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list