-
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 from single table only (#121)
* extract_ functions can now work with a single table or an entire traits.build database; the single table can have any columns, any number of columns * required a tweak to check_compatibility to allow single tables to be declared compatible. A extra parameter was added that indicates if the incoming data is allowed to be a single table * lots of documentation that was supposed to be on the previous commit Closes issue #120
- Loading branch information
Showing
36 changed files
with
325 additions
and
275 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
#' @description Function to check whether the data object has been compiled by the traits.build workflow and | ||
#' therefore has a data structure that is appropriate for use with austraits functions. | ||
#' @param database traits.build database (list object) | ||
#' @param single_table_allowed logical for when the input might be a single table instead of a complete database; defaults to FALSE | ||
#' | ||
#' @return logical (T/F) output and messaging for uncompatible versions | ||
#' | ||
|
@@ -11,28 +12,36 @@ | |
#' } | ||
#' @author Elizabeth Wenk - [email protected] | ||
|
||
check_compatibility <- function(database) { | ||
check_compatibility <- function(database, single_table_allowed = FALSE) { | ||
|
||
if (is.null(database$metadata)) { | ||
if (!is.null(dim(database)) & single_table_allowed == TRUE) { | ||
|
||
compatible <- FALSE | ||
|
||
# message("You are working with AusTraits version 3.0 or earlier. \nThis database structure is unsupported by the current version of this package. \nPlease see https://github.com/traitecoevo/austraits for details on installing old versions of the package.") | ||
compatible <- TRUE | ||
|
||
} else { | ||
|
||
compiled_by_traits.build <- | ||
database$metadata$related_identifiers %>% | ||
convert_list_to_df2() %>% | ||
dplyr::filter(relation_type == "isCompiledBy") %>% | ||
dplyr::filter(stringr::str_detect(identifier, "github.com/traitecoevo/traits.build")) | ||
|
||
if(is.null(compiled_by_traits.build) | nrow(compiled_by_traits.build) > 0) { | ||
compatible <- TRUE | ||
} else{ | ||
if (is.null(database$metadata)) { | ||
|
||
compatible <- FALSE | ||
|
||
# message("You are working with AusTraits version 4, which is unsupported by the current version of this package. \nPlease see https://github.com/traitecoevo/austraits for details on installing old versions of the package.") | ||
# message("You are working with AusTraits version 3.0 or earlier. \nThis database structure is unsupported by the current version of this package. \nPlease see https://github.com/traitecoevo/austraits for details on installing old versions of the package.") | ||
|
||
} else { | ||
|
||
compiled_by_traits.build <- | ||
database$metadata$related_identifiers %>% | ||
convert_list_to_df2() %>% | ||
dplyr::filter(relation_type == "isCompiledBy") %>% | ||
dplyr::filter(stringr::str_detect(identifier, "github.com/traitecoevo/traits.build")) | ||
|
||
if(is.null(compiled_by_traits.build) | nrow(compiled_by_traits.build) > 0) { | ||
compatible <- TRUE | ||
} else{ | ||
compatible <- FALSE | ||
|
||
# message("You are working with AusTraits version 4, which is unsupported by the current version of this package. \nPlease see https://github.com/traitecoevo/austraits for details on installing old versions of the package.") | ||
} | ||
|
||
} | ||
|
||
} | ||
|
Oops, something went wrong.