## load distance matrix
data(d_geo)
## create a weight matrix
geow.50 <- WeightMatrix(d_geo, bandwidth=50)
## load contextual data
data(traces_event)
## aggregate data
wv.int <- SpawAggregate(contextual.data=traces_event,
context.id="area.name",
contextual.names=c("w_all", "w_all"),
contextual.weight.matrices=list(NULL, geow.50),
aggregation.functions="weighted.mean",
design.weight.names="weight",
nb.resamples=4)
## check the number of samples
length(wv.int)
## check the second sample
head(wv.int[2])
## change the names of the weighted indicators to more significant ones
names(wv.int) <- c("w_all.0", "w_all.50")
showClass("SpawAggregateOutput")
Run the code above in your browser using DataLab