Title: | Provides Templates for Metadata Files Associated with Species Range Models |
---|---|
Description: | Range Modeling Metadata Standards (RMMS) address three challenges: they (i) are designed for convenience to encourage use, (ii) accommodate a wide variety of applications, and (iii) are extensible to allow the community of range modelers to steer it as needed. RMMS are based on a data dictionary that specifies a hierarchical structure to catalog different aspects of the range modeling process. The dictionary balances a constrained, minimalist vocabulary to improve standardization with flexibility for users to provide their own values. Merow et al. (2019) <DOI:10.1111/geb.12993> describe the standards in more detail. Note that users who prefer to use the R package 'ecospat' can obtain it from <https://github.com/ecospat/ecospat>. |
Authors: | Cory Merow [aut, cre], Brian Maitner [aut], Hannah Owens [aut], Jamie Kass [aut], Brian Enquist [aut], Rob Guralnik [aut], Damaris Zurrell [aut], Christian Koenig [aut] |
Maintainer: | Cory Merow <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.4 |
Built: | 2025-02-13 04:14:17 UTC |
Source: | https://github.com/cmerow/rangemodelmetadata |
Cleans up metadata instances that get messy if one tries to write them directly to csv tables (i.e. extent objects, bibtex objects.)
cleanForCSV(x = NULL)
cleanForCSV(x = NULL)
x |
An |
This is a utility function for use by rmmToCSV
.
Reformatted element for use in rmmToCSV
function.
Hannah Owens <[email protected]>, Cory Merow <[email protected]>, Brian Maitner <[email protected]>
Other csvConversion:
csvToRMM()
,
rmmToCSV()
Takes user-input .csv file and converts it to a rangeModelMetaData ('rmm') object.
csvToRMM(csv, family = NULL)
csvToRMM(csv, family = NULL)
csv |
A character file path to the csv file. |
family |
character string; specifies an application profile (use case) by specifying the families of entities that should be included. Specifying NULL includes all entities. Use |
See Examples.
An rmm
object that was read from the supplied .csv text file.
Hannah Owens <[email protected]>
Other csvConversion:
cleanForCSV()
,
rmmToCSV()
csv <- "somePathOnYourMachine/rmm_example.csv"; ## Not run: temp <- csvToRMM(csv);
csv <- "somePathOnYourMachine/rmm_example.csv"; ## Not run: temp <- csvToRMM(csv);
This function populates occurrence field in an rmm object with output from a BIEN_occurrence_... query
rmmAutofillBIEN(rmm, occurrences)
rmmAutofillBIEN(rmm, occurrences)
rmm |
an rmm list |
occurrences |
an occurrence data.frame obtained from a BIEN occurrence query |
See Examples.
a range model metadata list
Cory Merow <[email protected]>, Brian Maitner <[email protected]>,
Other autofill:
rmmAutofillEnvironment()
,
rmmAutofillPackageCitation()
,
rmmAutofillspocc()
## Not run: rmm <- rmmTemplate() xs <- BIEN::BIEN_occurrence_species(species="Xanthium strumarium") rmmAutofillBIEN(rmm = rmm, occurrences = xs) ## End(Not run)
## Not run: rmm <- rmmTemplate() xs <- BIEN::BIEN_occurrence_species(species="Xanthium strumarium") rmmAutofillBIEN(rmm = rmm, occurrences = xs) ## End(Not run)
This can be used with environmental layers used for fitting or transferring
rmmAutofillEnvironment(rmm, env, transfer)
rmmAutofillEnvironment(rmm, env, transfer)
rmm |
an rmm list |
env |
a SPatRaster object |
transfer |
0 if not transfer, 1:n for n environments that you're transferring to |
See Examples.
a range model metadata list
Cory Merow <[email protected]>, Brian Maitner <[email protected]>,
Other autofill:
rmmAutofillBIEN()
,
rmmAutofillPackageCitation()
,
rmmAutofillspocc()
## Not run: rmm <- rmmTemplate() rasterFiles <- list.files(path=paste(system.file(package='dismo'), '/ex', sep=''), pattern='grd', full.names=TRUE) #make a stack of the rasters env <- terra::rast(rasterFiles) # for fitting environment rmm <- rmmAutofillEnvironment(rmm,env,transfer=0) # for the first environment that you're transfering to rmm <- rmmAutofillEnvironment(rmm,env,transfer=1) # for the second environment that you're transfering to, etc. rmm <- rmmAutofillEnvironment(rmm,env,transfer=2) ## End(Not run)
## Not run: rmm <- rmmTemplate() rasterFiles <- list.files(path=paste(system.file(package='dismo'), '/ex', sep=''), pattern='grd', full.names=TRUE) #make a stack of the rasters env <- terra::rast(rasterFiles) # for fitting environment rmm <- rmmAutofillEnvironment(rmm,env,transfer=0) # for the first environment that you're transfering to rmm <- rmmAutofillEnvironment(rmm,env,transfer=1) # for the second environment that you're transfering to, etc. rmm <- rmmAutofillEnvironment(rmm,env,transfer=2) ## End(Not run)
Using bibtex citations
rmmAutofillPackageCitation(rmm, packages)
rmmAutofillPackageCitation(rmm, packages)
rmm |
an rmm list |
packages |
a vector of quoted package names |
See Examples.
a range model metadata list
Brian Maitner <[email protected]>, Cory Merow <[email protected]>
Other autofill:
rmmAutofillBIEN()
,
rmmAutofillEnvironment()
,
rmmAutofillspocc()
rmm <- rmmTemplate() rmm <- rmmAutofillPackageCitation(rmm,c('terra','sf'))
rmm <- rmmTemplate() rmm <- rmmAutofillPackageCitation(rmm,c('terra','sf'))
This function populates occurrence field in an rmm object with output from a spocc query
rmmAutofillspocc(rmm, occ)
rmmAutofillspocc(rmm, occ)
rmm |
an rmm list |
occ |
Output from |
See Examples.
a range model metadata list
Cory Merow <[email protected]>, Brian Maitner <[email protected]>,
Other autofill:
rmmAutofillBIEN()
,
rmmAutofillEnvironment()
,
rmmAutofillPackageCitation()
## Not run: rmm <- rmmTemplate() xs <- spocc::occ("Xanthium strumarium") rmmAutofillspocc(rmm = rmm, occ = xs) ## End(Not run)
## Not run: rmm <- rmmTemplate() xs <- spocc::occ("Xanthium strumarium") rmmAutofillspocc(rmm = rmm, occ = xs) ## End(Not run)
Identify empty fields in an rmm object and classify these into obligate and optional fields.
rmmCheckEmpty(rmm, family = c("base"))
rmmCheckEmpty(rmm, family = c("base"))
rmm |
a range model metadata list |
family |
an rmm family, "base" by default |
See Examples.
A dataframe containing empty fields labeled as obligate, optional, or suggested.
Cory Merow <[email protected]>, Brian Maitner <[email protected]>,
Other check:
rmmCheckFinalize()
,
rmmCheckMissingNames()
,
rmmCheckName()
,
rmmCheckValue()
,
rmmCleanNULLs()
#First, make an empty rmm object: rmm <- rmmTemplate() #Next, we check for emtpy fields: empties1 <- rmmCheckEmpty(rmm = rmm) #If looks like there are quite a few empty obligate fields. Let's populate a few: rmm$data$occurrence$taxon <- "Acer rubrum" rmm$data$environment$variableNames <- "Bio1" #Now, if we run rmmCheckEmpty again, we see there are 2 fewer empty, obligate fields empties2 <- rmmCheckEmpty(rmm = rmm)
#First, make an empty rmm object: rmm <- rmmTemplate() #Next, we check for emtpy fields: empties1 <- rmmCheckEmpty(rmm = rmm) #If looks like there are quite a few empty obligate fields. Let's populate a few: rmm$data$occurrence$taxon <- "Acer rubrum" rmm$data$environment$variableNames <- "Bio1" #Now, if we run rmmCheckEmpty again, we see there are 2 fewer empty, obligate fields empties2 <- rmmCheckEmpty(rmm = rmm)
Check an rmm object for non-standard and missing values and fields
rmmCheckFinalize(rmm, family = c("base"))
rmmCheckFinalize(rmm, family = c("base"))
rmm |
a range model metadata list |
family |
The rmm family to check the rmm against |
See Examples.
Prints feedback to point out possible errors.
Cory Merow <[email protected]>, Brian Maitner <[email protected]>,
Other check:
rmmCheckEmpty()
,
rmmCheckMissingNames()
,
rmmCheckName()
,
rmmCheckValue()
,
rmmCleanNULLs()
rmm <- rmmTemplate() # Make an empty template rmmCheckFinalize(rmm)
rmm <- rmmTemplate() # Make an empty template rmmCheckFinalize(rmm)
Identify obligate fields that are missing
rmmCheckMissingNames(rmm, family = c("base"))
rmmCheckMissingNames(rmm, family = c("base"))
rmm |
a range model metadata list |
family |
The rmm family to check the rmm against |
See Examples.
A vector of names that are missing from the rmm object.
Cory Merow <[email protected]>, Brian Maitner <[email protected]>,
Other check:
rmmCheckEmpty()
,
rmmCheckFinalize()
,
rmmCheckName()
,
rmmCheckValue()
,
rmmCleanNULLs()
rmm <- rmmTemplate() # Make an empty template
rmm <- rmmTemplate() # Make an empty template
Identify nonstandard fields
rmmCheckName( rmm, cutoff_distance = 3, returnData = F, interactiveCorrections = FALSE )
rmmCheckName( rmm, cutoff_distance = 3, returnData = F, interactiveCorrections = FALSE )
rmm |
a range model metadata list |
cutoff_distance |
number of allowed different characters to match standardized names |
returnData |
logical. If FALSE, the function will return the (possibly) corrected rmm object. If TRUE, the function will return a data.frame containing information on incorrect names. |
interactiveCorrections |
logical. If TRUE, the user will be prompted to indicate whether the proposed correction should be accepted, thereby modifying the 'rmm' object. If FALSE, suggestions will just be printed to the screen and users can edit them manually. |
See Examples.
Either an rmm list object ('returnData=FALSE') or a data.frame containing information on possible name errors ('returnData=TRUE').
Names returned by this check may be either incorrectly named or correctly named but missing from the data dictionary.
Cory Merow <[email protected]>, Brian Maitner <[email protected]>,
Other check:
rmmCheckEmpty()
,
rmmCheckFinalize()
,
rmmCheckMissingNames()
,
rmmCheckValue()
,
rmmCleanNULLs()
rmm <- rmmTemplate() # Make an empty template rmm$dataPrep$biological$taxonomicHarmonization$taxonomy_source <- "The Plant List" # Add a new, non-standard field rmm.1 <- rmmCheckName(rmm) # Checking the names should identify the new, non-standard field we've added ("taxonomy_source")
rmm <- rmmTemplate() # Make an empty template rmm$dataPrep$biological$taxonomicHarmonization$taxonomy_source <- "The Plant List" # Add a new, non-standard field rmm.1 <- rmmCheckName(rmm) # Checking the names should identify the new, non-standard field we've added ("taxonomy_source")
Run shiny app to visualize rmm check functions
rmmCheckShiny()
rmmCheckShiny()
See Examples.
None
This function launches a shiny app in the default web browser
Jamie Kass <[email protected]>
## Not run: rmm1 <- rmmTemplate() rmm1 <- rmmAutofillPackageCitation(rmm1,c('raster','sp')) rasterFiles <- list.files(path=paste(system.file(package='dismo'), '/ex', sep=''), pattern='grd', full.names=TRUE) make a stack of the rasters env <- terra::rast(rasterFiles) # for fitting environment rmm1 <- rmmAutofillEnvironment(rmm1,env,transfer=0) # for transfer environment 1 (assuming different than for fitting) rmm1 <- rmmAutofillEnvironment(rmm1,env,transfer=1) # for transfer environment 2 (assuming different than 1) rmm1 <- rmmAutofillEnvironment(rmm1,env,transfer=2) ## End(Not run) ## Not run: rmmCheckShiny(rmm1)
## Not run: rmm1 <- rmmTemplate() rmm1 <- rmmAutofillPackageCitation(rmm1,c('raster','sp')) rasterFiles <- list.files(path=paste(system.file(package='dismo'), '/ex', sep=''), pattern='grd', full.names=TRUE) make a stack of the rasters env <- terra::rast(rasterFiles) # for fitting environment rmm1 <- rmmAutofillEnvironment(rmm1,env,transfer=0) # for transfer environment 1 (assuming different than for fitting) rmm1 <- rmmAutofillEnvironment(rmm1,env,transfer=1) # for transfer environment 2 (assuming different than 1) rmm1 <- rmmAutofillEnvironment(rmm1,env,transfer=2) ## End(Not run) ## Not run: rmmCheckShiny(rmm1)
Identify nonstandard values
rmmCheckValue(rmm, cutoff_distance = 3, returnData = F)
rmmCheckValue(rmm, cutoff_distance = 3, returnData = F)
rmm |
a range model metadata list |
cutoff_distance |
The maximum allowable similarity (Levenshtein (edit) distance) for use in fuzzy matching. |
returnData |
Should a dataframe containing information on matched and unmatched values be returned? Default is FALSE |
See Examples.
Text describing identical, similar and non-matched values for rmm entities with suggested values. If returnData = T, a dataframe is returned containing 5 columns: field (the rmm entity), exact_match (values that appear correct), partial_match (values that are partial_match to common values), not_matched( values that are dissimilar from accepted values), partial_match_suggestions (suggested values for partial_match values).
Names returned by this check may be either incorrectly named or correctly named but missing from the data dictionary.
Cory Merow <[email protected]>, Brian Maitner <[email protected]>, Hannah Owens <[email protected]>
Other check:
rmmCheckEmpty()
,
rmmCheckFinalize()
,
rmmCheckMissingNames()
,
rmmCheckName()
,
rmmCleanNULLs()
rmm <- rmmTemplate() #First, we create an empty rmm template rmm$data$environment$variableNames <- c("bio1", "bio 2", "bio3", "cromulent") #We add 3 of the bioclim layers, including a spelling error (an extra space) in bio2, # and a word that is clearly not a climate layer, 'cromulent'. rmmCheckValue(rmm = rmm) #Now, when we check the values, we see that bio1 and bio2 are reported as exact matches, #while 'bio 2' is flagged as a partial match with a suggested value of 'bio2', # and cromulent is flagged as not matched at all. #If we'd like to return a dataframe containing this information in a perhaps more useful format: rmmCheckValue_output <- rmmCheckValue(rmm = rmm, returnData = TRUE)
rmm <- rmmTemplate() #First, we create an empty rmm template rmm$data$environment$variableNames <- c("bio1", "bio 2", "bio3", "cromulent") #We add 3 of the bioclim layers, including a spelling error (an extra space) in bio2, # and a word that is clearly not a climate layer, 'cromulent'. rmmCheckValue(rmm = rmm) #Now, when we check the values, we see that bio1 and bio2 are reported as exact matches, #while 'bio 2' is flagged as a partial match with a suggested value of 'bio2', # and cromulent is flagged as not matched at all. #If we'd like to return a dataframe containing this information in a perhaps more useful format: rmmCheckValue_output <- rmmCheckValue(rmm = rmm, returnData = TRUE)
Check if fields are NULL in a range model metadata list and toss
rmmCleanNULLs(rmm)
rmmCleanNULLs(rmm)
rmm |
a range model metadata list |
See Examples.
printout to the console
Cory Merow <[email protected]>, Brian Maitner <[email protected]>,
Other check:
rmmCheckEmpty()
,
rmmCheckFinalize()
,
rmmCheckMissingNames()
,
rmmCheckName()
,
rmmCheckValue()
# see vignette('rmm_vignette')
# see vignette('rmm_vignette')
For viewing only
rmmDataDictionary(excel = FALSE)
rmmDataDictionary(excel = FALSE)
excel |
logical; open in excel? |
If 'excel==FALSE', returns a data.frame, if 'excel==TRUE' it returns nothing but attempts to open the metadata dictionary in excel.
dd=rmmDataDictionary()
dd=rmmDataDictionary()
Used to see options to for specifying an rmm object template
rmmFamilies()
rmmFamilies()
a vector of characters, indicating which RMMS families are supported
rmmFamilies()
rmmFamilies()
Supply fields to receive suggested inputs
rmmSuggest(charString, fullFieldDepth = FALSE)
rmmSuggest(charString, fullFieldDepth = FALSE)
charString |
string referencing fields of the form 'field1$field2' or 'field1$field2$field3', etc. |
fullFieldDepth |
print all fields below the current field depth rmm1 <- rmmTemplate() rmmSuggest('dataPrep',fullFieldDepth=FALSE) rmmSuggest('dataPrep',fullFieldDepth=TRUE) rmmSuggest('dataPrep$errors$duplicateRemoval') rmmSuggest('dataPrep$errors$duplicateRemoval$rule') rmmSuggest('model') rmmSuggest('modelFit$algorithmSettings$') rmmSuggest('modelFit$algorithmSettings$maxent$') rmmSuggest('$modelFit$algorithmSettings$maxent$featureSet') |
See Examples.
list of suggestions
Cory Merow <[email protected]>, Brian Maitner <[email protected]>,
Make an empty metadata list
rmmTemplate(family = NULL)
rmmTemplate(family = NULL)
family |
character string; specifies an application profile (use case) by specifying the families of entities that should be included. Specifying NULL includes all entities. Use 'rmmFamilies' to see supported values. |
See Examples.
a range model metadata list
Cory Merow <[email protected]>, Brian Maitner <[email protected]>
rmm1 <- rmmTemplate() rmm2 <- rmmTemplate(family=c('base')) str(rmm2)
rmm1 <- rmmTemplate() rmm2 <- rmmTemplate(family=c('base')) str(rmm2)
Takes user-input rangeModelMetaData object and from it generates a .csv file that can be used to document range model metadata for a variety of applications.
rmmToCSV(x = rmmTemplate(family = NULL), filename = NULL)
rmmToCSV(x = rmmTemplate(family = NULL), filename = NULL)
x |
An object of class |
filename |
The name of the transcription .csv file. |
See Examples.
An data frame containing all the information from an rmm
object.
Hannah Owens <[email protected]>, Cory Merow <[email protected]>
Other csvConversion:
cleanForCSV()
,
csvToRMM()
rmm <- rmmTemplate() rasterFiles <- list.files(path=paste(system.file(package='dismo'), '/ex', sep=''), pattern='grd', full.names=TRUE) #make a stack of the rasters env <- terra::rast(rasterFiles) # for fitting environment rmm <- rmmAutofillEnvironment(rmm,env,transfer=0) # for the first environment that you're transfering to rmm <- rmmAutofillEnvironment(rmm,env,transfer=1) # for the second environment that you're transfering to, etc. rmm <- rmmAutofillEnvironment(rmm,env,transfer=2) ## Not run: tmp <- rmmToCSV(rmm,file='somePathOnYourMachine/rmm_example.csv') ## End(Not run)
rmm <- rmmTemplate() rasterFiles <- list.files(path=paste(system.file(package='dismo'), '/ex', sep=''), pattern='grd', full.names=TRUE) #make a stack of the rasters env <- terra::rast(rasterFiles) # for fitting environment rmm <- rmmAutofillEnvironment(rmm,env,transfer=0) # for the first environment that you're transfering to rmm <- rmmAutofillEnvironment(rmm,env,transfer=1) # for the second environment that you're transfering to, etc. rmm <- rmmAutofillEnvironment(rmm,env,transfer=2) ## Not run: tmp <- rmmToCSV(rmm,file='somePathOnYourMachine/rmm_example.csv') ## End(Not run)