| pal_events | R Documentation |
pal_events() builds the core data object used throughout palsr: a table of
dyadic interaction events, each involving two actors at a known time and location.
Projected Actor Locations are computed from these histories.
pal_events(
data,
actor1 = "actor1",
actor2 = "actor2",
time = "time",
lon = "lon",
lat = "lat",
drop_self = TRUE
)
data |
A |
actor1, actor2 |
Column names (length-1 character) identifying the two actors involved in each event. The pair is treated as unordered. |
time |
Column name of the event time. Must be a |
lon, lat |
Column names of the event longitude and latitude, in decimal degrees. |
drop_self |
Logical; drop events whose two actors are identical (default |
Longitudes must lie in [-180, 180] and latitudes in [-90, 90]. Rows with
missing actor, time, or coordinate values are dropped with a message.
An object of class pal_events (a data.frame subclass) with canonical
columns actor1, actor2, time, lon, lat, sorted by time.
df <- data.frame(
from = c("A", "A", "B"),
to = c("B", "C", "C"),
when = as.Date(c("2001-01-01", "2001-06-01", "2002-01-01")),
x = c(7.1, 8.0, 7.5),
y = c(9.0, 9.4, 10.1)
)
ev <- pal_events(df, actor1 = "from", actor2 = "to",
time = "when", lon = "x", lat = "y")
ev
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.