gData-class: Formal class "gData"

gData-classR Documentation

Formal class "gData"

Description

The class gData is a formal (S4) class storing georeferenced data, consisting in a set of locations (longitude and latitude) where one or several variables have been measured. These data are designed to be matched against a gGraph object, each location being assigned to the closest node of the gGraph object.

Details

Note that for several operations on a gData object, the gGraph object to which it is linked will have to be present in the same environment.

Slots

coords

a matrix of spatial coordinates with two columns, being respectively longitude (from -180 to 180) and latitude. Positive numbers are intended as 'east' and 'north', respectively.

nodes.id

a vector of character strings giving the name of the nodes (of the gGraph object) associated to the locations.

data

any kind of data associated to the locations in coords. For matrix-like objects, rows should correspond to locations.

gGraph.name

a character string the name of the gGraph object against which the object is matched.

Note that none of these is mandatory: new("gData") would work, and create an empty gGraph object. Also note that a finer matching of locations against the nodes of a gGraph object can be achieved after creating the object, for instance using the closestNode method.

Objects from the class gData

gData objects can be created by calls to new("gData", ...), where '...' can be the following arguments:

See Also

Related class:
- gGraph

Examples


hgdp

## plot data
plot(worldgraph.40k, pch = "")
points(hgdp)

## subset and plot data
onlyNorth <- hgdp[hgdp@data$Latitude > 0] # only northern populations

plot(worldgraph.40k, reset = TRUE)
abline(h = 0) # equator
points(onlyNorth, pch.node = 20, cex = 2, col.node = "purple")


thibautjombart/geograph documentation built on Jan. 27, 2024, 10 p.m.