Description Usage Arguments Details Value References See Also
View source: R/st_indicators.R
Get the spatio-temporal neighbourhoods of all observations
1 2 3 4 5 6 7 8 9 10 11 12 | get_all_neib_vals(
df,
max_radius,
t_dist_mat,
s_dist_mat,
alpha,
vars,
time_id,
site_id,
parallel = FALSE,
nsplits = 4
)
|
df |
a data frame of observations |
max_radius |
the maximum spatio-temporal distance allowed to be included in a neighbourhood |
t_dist_mat |
a matrix of normalized temporal distances between time-stamps (rownames and colnames should be a concatenation of "TIME_" and the time-stamp) |
s_dist_mat |
a matrix of normalized spatial distances between locations (rownames and colnames should be a concatenation of "SITE_" and the location IDs) |
alpha |
a weighting factor for the spatio-temporal distance |
vars |
Vector of character strings indicating the columns whose values should be retrieved |
time_id |
the name of the column containing time-stamps |
site_id |
the name of the column containing location IDs |
parallel |
Boolean indicating whether the code should run in parallel. Default is FALSE |
nsplits |
Number of subsets of rows to split the data frame into so they can be processed in parallel |
The spatio-temporal distance is defined as
D_{i,j} = d_{i,j} x α + t_{i,j} x (1-α)
where d_i,j is the spatial distance between
locations, t_i,j is the temporal distance
between time-stapms and α is a weighting factor.
Note that the radius
should always be a number between
zero and min(alpha, alpha-1)
.
Also note that if alpha
is set to 1, then instead of a cone,
the neighbourhood will have the shape of a cylinder.
A data frame where each row describes a neighbour, with the first two columns containing the location ID and time-stamp of the central observation, followed by two columns with the neighbouring location ID and time-stamp, a colunm containing the spatio-temporal distance between the two, and a final column containing the values of the variables in df at the neighbouring time and location.
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.258.8742&rep=rep1&type=pdf
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.