This function builds the trajectory_locations table, which is used by palms_build_trajectories to identify trajectories that start and end at specific locations. For example, a trip from home to work, or from school to a park. This is done by setting a start and end criteria.

palms_add_trajectory_location(name, start_criteria, end_criteria)

Arguments

name

The name of the trip as a string.

start_criteria

The start of the trip. This should evaluate to a boolean. For optimal speed, this should be a field pre-calculated in palmsplus.

end_criteria

The end of the trip. This should evaluate to a boolean. For optimal speed, this should be a field pre-calculated in palmsplus.

Value

If the trajectory_locations table is not present in the global environment, it will be created. If it already exists, the new location will be appended.

Examples

# A full example workflow data(list = c("palms", "home", "school", "participant_basis")) palms_add_field("at_home", "palms_in_polygon(., filter(palms_buffer(home, distance = 100), identifier == i), identifier)") palms_add_field("at_school", "palms_in_polygon(., filter(school, school_id == participant_basis %>% filter(identifier == i) %>% pull(school_id)))") palmsplus <- palms_build_palmsplus(palms)
#> [1/1] Computed palmsplus for: BC0627
palms_add_trajectory_location("home_school", "at_home", "at_school") trajectories <- palms_build_trajectories