od_filter | R Documentation |
This function takes and OD dataset and a character vector of codes and returns an OD dataset with rows matching origin and destinations zones present in the codes.
od_filter(x, codes, silent = FALSE)
x |
A data frame in which the first two columns are codes representing points/zones of origin and destination |
codes |
The zone codes that must be in origins and destination |
silent |
Hide messages? |
A data frame
x = od_data_df z = od_data_zones codes = z[[1]] z_in_x_o = codes %in% x[[1]] z_in_x_d = codes %in% x[[2]] sum(z_in_x_d) sum(z_in_x_o) z = z[which(z_in_x_o | z_in_x_d)[-1], ] z[[1]] unique(c(x[[1]], x[[2]])) try(od_to_sf(x, z)) # fails nrow(x) x = od_filter(x, z[[1]]) nrow(x) od_to_sf(x, z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.