[R-sig-Geo] How to get point pairs form variogram cloud in gstat package

vetter vetter at pik-potsdam.de
Mon Mar 14 18:43:26 CET 2011


I guess var1 is a variogramCloud. More complete code:

 > var1=variogram(val~1,geoObject,cloud=T)
 > var1[1,]
dist gamma dir.hor dir.ver id left right
1 63834.75 0.08506403 0 0 var1 2 1
 > as.data.frame(var1)$left
NULL


str(var1) gives:

Classes ‘variogramCloud’ and 'data.frame': 9253 obs. of 6 variables:
$ np : num 1 2 65538 3 65539 ...
$ dist : num 63835 97833 158641 251475 312811 ...
$ gamma : num 0.085 2.222 1.438 7.132 5.659 ...
$ dir.hor: num 0 0 0 0 0 0 0 0 0 0 ...
$ dir.ver: num 0 0 0 0 0 0 0 0 0 0 ...
$ id : Factor w/ 1 level "var1": 1 1 1 1 1 1 1 1 1 1 ...
- attr(*, "direct")='data.frame': 1 obs. of 2 variables:
..$ id : Factor w/ 1 level "var1": 1
..$ is.direct: logi TRUE
- attr(*, ".BigInt")= num 65536


> make sure var1 is a variogramCloud, obtained by
>
> variogram(..., cloud=TRUE)
>
> On 03/14/2011 06:27 PM, vetter wrote:
>> It is not working:
>>
>>> as.data.frame(var1)[1,]
>>    np     dist     gamma dir.hor dir.ver   id
>> 1  1 63834.75 0.2057185       0       0 var1
>>
>> and therefore:
>>
>>> as.data.frame(var1)$left
>> NULL
>>
>>
>>> On 03/14/2011 05:47 PM, vetter wrote:
>>>> I computed a variogram cloud using the gstat package.
>>>>
>>>> My results look like this:
>>>>
>>>>> var1[,1]
>>> that was probably a
>>>
>>> var[1,]
>>>
>>>>              dist     gamma      dir.hor  dir.ver   id     left  right
>>>> 1 63834.75 0.2057185       0       0         var1    2     1
>>>>
>>>> My question is:
>>>> How can I extract the values from column "left" and "right" from this
>>>> object?
>>>>
>>> By coercion to a data.frame, and selecting:
>>>
>>> as.data.frame(var1)$left
>>> as.data.frame(var1)$right
>>>
>>>> Thanks Tobias Vetter
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> R-sig-Geo at r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list