-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract
add parameter for exact matches (#156)
* Add option to extract_ functions to only allow exact matches - versus the default which uses partial string matches. There are instances where partial matches return too much data: For instance - searching on trait = "leaf_area" returns data for "leaf_area" and "leaf_area_ratio" - searching for taxonomic_status = "accepted" also returns data for "genus accepted" and therefore more taxon names than are sought. The default is still for partial matches, but there is now a parameter "partial_matches_allowed" which can be set to FALSE. closes issue #150 * Bug fix in `extract_data` that turned up through AusFizz. It was possible for the grouping variables designated in the #Rejoining Contexts section of this function to be identical across multiple context properties (dataset_id, category, link_id, value, description). There were 4 datasets in AusFizz where this was the case. This led to duplicate listings of link_vals and then as a follow-on join_contexts didn't work because there were duplicate link_vals. closes issue #154
- Loading branch information
Showing
5 changed files
with
55 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
#' @author Fonti Kar - [email protected] | ||
#' @export | ||
|
||
extract_taxa <- function(database, family = NULL, genus = NULL, taxon_name = NULL){ | ||
extract_taxa <- function(database, family = NULL, genus = NULL, taxon_name = NULL, partial_matches_allowed = TRUE){ | ||
# Check compatability | ||
status <- check_compatibility(database, single_table_allowed = TRUE) | ||
|
||
|
@@ -40,15 +40,15 @@ extract_taxa <- function(database, family = NULL, genus = NULL, taxon_name = NUL | |
} | ||
|
||
if( ! is.null(family) ){ | ||
return(extract_data(database, "taxa", "family", col_value = family)) | ||
return(extract_data(database, "taxa", "family", col_value = family, partial_matches_allowed = partial_matches_allowed)) | ||
} | ||
|
||
if( ! is.null(genus) ){ | ||
return(extract_data(database, "taxa", "genus", col_value = genus)) | ||
return(extract_data(database, "taxa", "genus", col_value = genus, partial_matches_allowed = partial_matches_allowed)) | ||
} | ||
|
||
if( ! is.null(taxon_name)) | ||
return(extract_data(database, "traits", "taxon_name", col_value = taxon_name)) | ||
return(extract_data(database, "traits", "taxon_name", col_value = taxon_name, partial_matches_allowed = partial_matches_allowed)) | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters