# How do I make from a SpatialGridDataframe a normal data frame? If I do
this in package gstat:

library(gstat)
g.dummy <- gstat(formula = z~1, locations = ~x+y, dummy = TRUE, beta = 0,
model = vgm(1,"Exp",15), nmax = 20)
set.seed(1)
iso <- predict(g.dummy, newdata = xy, nsim = 10)
gridded(iso) = ~x+y
# spplot(iso,main="isotropic")  # not essential for this question

# I could make a dataframe like:
diso<-data.frame(iso)
diso[1:4,]

# which results in:

#   x y      sim1      sim2       sim3      sim4      sim5      sim6
sim7       sim8      sim9      sim10
# 1 1 1 0.4093776 1.0752794 -1.5654566 0.6183240 -2.196812 0.4545051
-0.06372423 -2.1544707 -1.131036 -0.4008869
# 2 2 1 0.8133436 0.9041941 -0.9712924 0.4319641 -2.432893 1.0770354
0.21302299 -1.6938882 -2.065350 -0.5331123
# 3 3 1 0.8238881 0.8631968 -1.2171113 0.7419403 -2.272203 0.7142655
0.73733467 -1.3179448 -1.390438 -0.1957735
# 4 4 1 0.5143664 1.1752801 -1.3875604 1.0853372 -1.930405 0.1651254
0.20086256 -0.9873306 -1.120656  0.3361112

# if I want all the values in rows where y=1 for (e.g.) sim3, this gives
good results

diso[y==1,5]

# but x is not a numeric class and the following gives an error:

diso[x==1,5]

# since

class(y) # "numeric"
class(x) # "S4"

so how do I convert x to "numeric"?

Many thanks in advance!! Aad Termorshuizen

senior product manager bodemkwaliteit / soil quality
Blgg, Nieuwe kanaal 7F, 6709 PA Wageningen, The Netherlands
tel. +31-652002192, e-mail aad.termorshui...@blgg.nl, internet www.blgg.nl

________________________________________________________________________________________
Disclaimer:

Dit e-mailbericht is uitsluitend bestemd voor de geadresseerde(n). Indien dit 
e-mailbericht niet voor u bestemd is, verzoeken wij u vriendelijk doch 
dringend, de afzender van het bericht op hoogte te brengen en alle informatie 
uit uw computer te verwijderen zonder acht te nemen van de inhoud.
________________________________________________________________________________________

This E-mail has been scanned for viruses by the McAfee Appliance of Blgg B.V.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to