-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
107 changed files
with
2,684 additions
and
2,210 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,35 +1,34 @@ | ||
#' Check multiple time variables | ||
#' | ||
#' Check that we only have one set of times | ||
#' Check that we only have one set of times | ||
#' | ||
#' @param time_bp times in bp | ||
#' @param time_ce times in ce | ||
#' @param allow_null boolean whether both can be NULL | ||
#' @returns times in bp | ||
#' @keywords internal | ||
|
||
check_time_vars <- function(time_bp, time_ce, allow_null=TRUE) { | ||
if (all(!is.null(time_bp), !is.null(time_ce))){ | ||
check_time_vars <- function(time_bp, time_ce, allow_null = TRUE) { | ||
if (all(!is.null(time_bp), !is.null(time_ce))) { | ||
stop("both time_bp and time_ce were provide, the function can only accept one of the two") | ||
} | ||
if (all(is.null(time_bp), is.null(time_ce))){ | ||
if (allow_null){ | ||
if (all(is.null(time_bp), is.null(time_ce))) { | ||
if (allow_null) { | ||
return(NULL) | ||
} else { | ||
stop("either time_bp or time_ce should be provided") | ||
} | ||
|
||
} | ||
if (is.null(time_ce)){ | ||
if (is.null(time_ce)) { | ||
return(time_bp) | ||
} else { | ||
# convert it to bp | ||
if (inherits(time_ce, "list")){ | ||
return(lapply(time_ce,function(x){x-1950})) | ||
if (inherits(time_ce, "list")) { | ||
return(lapply(time_ce, function(x) { | ||
x - 1950 | ||
})) | ||
} else { | ||
return(time_ce-1950) | ||
return(time_ce - 1950) | ||
} | ||
|
||
|
||
} | ||
} |
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
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
Oops, something went wrong.