[R-sig-Geo] graph plotting from spatialgriddataframe
Roger Bivand
Roger.Bivand at nhh.no
Tue Mar 13 23:14:58 CET 2007
On Tue, 13 Mar 2007, Schmitt Thierry wrote:
> Following my question about comparing vectors and raster data, I would be keen on getting more insights.
>
> Here are the fact:
>
> I have converted the vector file (interpretation from underwater camera)
> to be compared with the raster file (morphometric classification from a
> multibeam sonar survey) using v.to.rast Using Mapcalc I have extracted
> grid cells from the multibeam raster along the resulting v.to.rast
> "transect". Both datasets were then imported in R using readRast6
>
> My main aim now is simply to plot on 2d graph each variable and then
> compute a regression.
So far so good. The object you have imported is a SpatialGridDataFrame,
and you can see what is inside it with the summary() method. The next step
will be to see if there are NAs (not available, missing values), because
they will affect the regression. The summary() method will say how many
NAs are present in each variable. If the numbers are identical for all the
variables - and the NAs are for the same raster cells, you can coerce the
object to SpatialPixelsDataFrame. But first, check the NAs.
Once that is done, the plots will be plot(y ~ x, data=obj), and regression
will be lm(y ~ x, data=obj), that is using the formula approach to
relationships between variables. For more on plot() and lm(), see the
Introduction to R included with the distribution.
Hope this helps,
Roger
>
>
> If any body can put me on tracks (i.e. suggesting the function to use),
> it will be more than welcome.
>
> Regards and thanks to the GRASS / R community.
>
> Thierry
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list