map_dep | R Documentation |
This function visualizes deployments features such as number of detected species, number of observations and RAI on a dynamic map. The circle size and colour are proportional to the mapped feature. Deployments without observations are shown as gray circles and a message is returned.
map_dep(
package = NULL,
feature,
...,
species = NULL,
sex = NULL,
life_stage = NULL,
effort_unit = NULL,
cluster = TRUE,
hover_columns = c("n", "species", "deploymentID", "locationID", "locationName",
"latitude", "longitude", "start", "end"),
palette = "inferno",
zero_values_show = TRUE,
zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/000000/multiply.png",
zero_values_icon_size = 10,
na_values_show = TRUE,
na_values_icon_url = "https://img.icons8.com/ios-glyphs/30/FA5252/multiply.png",
na_values_icon_size = 10,
relative_scale = TRUE,
max_scale = NULL,
radius_range = c(10, 50),
datapkg = lifecycle::deprecated()
)
package |
Camera trap data package object, as returned by
|
feature |
Deployment feature to visualize. One of:
|
... |
Filter predicates for subsetting deployments. |
species |
Character with a scientific name.
Required for |
sex |
Character defining the sex class to filter on, e.g. |
life_stage |
Character vector defining the life stage class to filter
on, e.g. |
effort_unit |
Time unit to use while visualizing deployment effort (duration). One of:
|
cluster |
Logical value indicating whether using the cluster option
while visualizing maps.
Default: |
hover_columns |
Character vector with the name of the columns to use for
showing location deployment information on mouse hover.
One or more from deployment columns.
Use
See the Deployment section of Camtrap DP for the full list of columns you can use. |
palette |
The palette name or the colour function that values will be mapped to. Typically one of the following:
|
zero_values_show |
Logical indicating whether to show deployments with
zero values.
Default: |
zero_values_icon_url |
Character with URL to icon for showing
deployments with zero values.
Default: a cross (multiply symbol)
|
zero_values_icon_size |
A number to set the size of the icon to show deployments with zero values. Default: 10. |
na_values_show |
Logical indicating whether to show deployments with
zero values. Notice that only feature |
na_values_icon_url |
Character with URL to icon for showing
deployments with |
na_values_icon_size |
A number to set the size of the icon to show
deployments with |
relative_scale |
Logical indicating whether to use a relative colour
and radius scale ( |
max_scale |
Number indicating the max value used to map colour and radius. |
radius_range |
Vector of length 2 containing the lower and upper limit
of the circle radius.
The lower value is used for deployments with zero feature value, i.e. no
observations, no identified species, zero RAI or zero effort.
The upper value is used for the deployment(s) with the highest feature
value ( |
datapkg |
Deprecated.
Use |
Leaflet map.
Check documentation about filter predicates: pred()
, pred_in()
,
pred_and()
, ...
## Not run:
# Show number of species
map_dep(
mica,
"n_species"
)
# Show number of observations (observations of unidentified species included
# if any)
map_dep(
mica,
"n_obs"
)
# Show number of observations of Anas platyrhynchos
map_dep(
mica,
"n_obs",
species = "Anas platyrhynchos"
)
# Show number of observations of subadult individuals of Anas strepera
map_dep(
mica,
"n_obs",
species = "Anas strepera",
life_stage = "subadult"
)
# Show number of observations of female or unknown individuals of gadwall
map_dep(
mica,
"n_obs",
species = "gadwall",
sex = c("female", "unknown")
)
# Show number of individuals (individuals of unidentified species included if
# any)
map_dep(
mica,
"n_individuals"
)
# Same filters by life stage and sex as for number of observations apply
map_dep(
mica,
"n_individuals",
species = "Anas strepera",
sex = "female",
life_stage = "adult"
)
# Show RAI
map_dep(
mica,
"rai",
species = "Anas strepera"
)
# Same filters by life_stage and sex as for number of observations apply
map_dep(
mica,
"rai",
species = "Anas strepera",
sex = "female",
life_stage = "adult"
)
# Show RAI calculated by using number of detected individuals
map_dep(
mica,
"rai_individuals",
species = "Anas strepera"
)
# Same filters by life stage and sex as for basic RAI apply
map_dep(
mica,
"rai_individuals",
species = "Anas strepera",
sex = "female",
life_stage = "adult"
)
# Show effort (hours)
map_dep(
mica,
"effort"
)
# Show effort (days)
map_dep(
mica,
"effort",
effort_unit = "day"
)
# Use viridis palette (viridis palettes)
map_dep(
mica,
"n_obs",
palette = "viridis"
)
# Use "BuPu" colour palette (RColorBrewer palettes)
map_dep(
mica,
"n_obs",
palette = "BuPu"
)
# Use a palette defined by colour names
map_dep(
mica,
"n_obs",
palette = c("black", "blue", "white")
)
# Use a palette defined by hex colours
map_dep(
mica,
"n_obs",
palette = c("#000000", "#0000FF", "#FFFFFF")
)
# Do not show deployments with zero values
map_dep(
mica,
"n_obs",
life_stage = "subadult",
zero_values_show = FALSE
)
# Use same icon but but a non default colour for zero values deployments,
# e.g. red (hex: E74C3C)
map_dep(
mica,
"n_obs",
life_stage = "subadult",
zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/E74C3C/multiply.png"
)
# ... or yellow (F1C40F)
map_dep(
mica,
"n_obs",
life_stage = "subadult",
zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/F1C40F/multiply.png"
)
# Use another icon via a different URL, e.g. the character Fry from Futurama
# in green (2ECC71)
map_dep(
mica,
"n_obs",
life_stage = "subadult",
zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/2ECC71/futurama-fry.png"
)
# Same behavior for the icon visualizing NA values (`"n_species"` feature)
unknown_species_vs_no_obs <- mica
unknown_species_vs_no_obs$data$observations <-
unknown_species_vs_no_obs$data$observations %>%
# a deployment has detected only unknown species
filter(is.na(.data$scientificName) |
.data$scientificName != "Homo sapiens") %>%
# a deployment has no observations
filter(deploymentID != "62c200a9-0e03-4495-bcd8-032944f6f5a1")
# create new map
map_dep(
unknown_species_vs_no_obs,
feature = "n_species",
zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/2ECC71/futurama-fry.png",
zero_values_icon_size = 60,
na_values_icon_url = "https://img.icons8.com/ios-glyphs/30/E74C3C/futurama-fry.png",
na_values_icon_size = 60
)
# Set size of the icon for zero values deployments
map_dep(
mica,
"n_obs",
life_stage = "subadult",
zero_values_icon_size = 30
)
# Disable cluster
map_dep(
mica,
"n_species",
cluster = FALSE
)
# Show only number of observations and location name while hovering
map_dep(
mica,
"n_obs",
hover_columns = c("locationName", "n")
)
# Use absolute scale for colours and radius
map_dep(mica,
"n_species",
relative_scale = FALSE,
max_scale = 4
)
# Change max and min size circles
map_dep(
mica,
"n_obs",
radius_range = c(40, 150)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.