Map taxonomic observations from a data frame. Input a dataframe with SampID, TaxaID, TaxaCount, Latitude, and Longitude. Other arguments are format (jpg vs. pdf), file name prefix, and output directory. Files are saved with the prefix "map.taxa." by default.
MapTaxaObs(
df_obs,
SampID,
TaxaID,
TaxaCount,
Lat,
Long,
output_dir = NULL,
output_prefix = "maps.taxa",
output_type = "pdf",
database,
regions,
map_grp = NULL,
leg_loc = "right",
...
)
Observation data frame
df_obs column name, Unique Sample identifier
df_obs column name, Unique Taxa identifier
df_obs column name, Number of individuals for TaxonID and SampID
df_obs column name, Latitude
df_obs column name, Longitude
Directory to save output. Default is working directory.
Prefix to TaxaID for each file. Default = "map.taxa."
File format for output; jpg or pdf.
maps::map function database; world, usa, state, county
maps::map function regions. Names pertinent to map_db.
Map grouping variable from df_obs. Will generate legend and color code the points on the map. Default = NULL
Legend location text. Default = "right" Other values may not work properly.
Optional arguments to be passed to methods.
Taxa maps to user defined directory as jpg or pdf.
The user will pass arguments for maps::map function that is used for the map. For example, 'database' and 'regions'. Without these arguments no map will be created.
The map will have all points and colored points for each taxon. In addition the map will include the number of samples by taxon.
The example data is fish but can be used for benthic macroinvertebrates as well.
If use grouping variable colors are from grDevices::rainbow()
Jpg file names replace all non-alphanumeric characters with "_".
The R package maps is required for this function.
df_obs <- data_Taxa_MA
SampID <- "estuary"
TaxaID <- "TaxaName"
TaxaCount <- "Count"
Lat <- "Latitude"
Long <- "Longitude"
output_dir <- tempdir()
output_prefix <- "maps.taxa."
output_type <- "pdf"
myDB <- "state"
myRegion <- "massachusetts"
myXlim <- c(-(73+(30/60)), -(69+(56/60)))
myYlim <- c((41+(14/60)),(42+(53/60)))
# Run function with extra arguments for map
if (FALSE) {
MapTaxaObs(df_obs
, SampID
, TaxaID
, TaxaCount
, Lat
, Long
, database="state"
, regions="massachusetts"
, xlim = myXlim
, ylim = myYlim
, map_grp = "estuary"
, leg_loc = "bottomleft")
}