Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move KSgeneral to Suggests #103

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Imports:
assertthat,
dplyr,
inbodb,
KSgeneral,
lubridate,
rlang,
stringr,
Expand All @@ -32,6 +31,7 @@ Imports:
Suggests:
DBI,
knitr,
KSgeneral,
purrr,
rmarkdown,
sf,
Expand All @@ -41,5 +41,5 @@ Remotes:
inbo/inbodb
LazyData: true
Encoding: UTF-8
RoxygenNote: 7.1.1
RoxygenNote: 7.2.3
VignetteBuilder: knitr
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export(get_locs)
export(get_xg3)
export(selectlocs_chem)
export(selectlocs_xg3)
importFrom(KSgeneral,disc_ks_test)
importFrom(assertthat,assert_that)
importFrom(assertthat,has_args)
importFrom(assertthat,has_name)
Expand Down
34 changes: 20 additions & 14 deletions R/eval.R
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,6 @@ qualify_xg3 <- function(data,
#' @importFrom rlang .data
#' @importFrom assertthat
#' assert_that
#' @importFrom KSgeneral
#' disc_ks_test
#' @importFrom stringr
#' str_detect
#' @importFrom stats
Expand All @@ -382,6 +380,8 @@ eval_xg3_series <- function(data,
max_gap,
min_dur) {

require_pkgs("KSgeneral")

if (missing(xg3_type)) {
xg3_type <- match.arg(xg3_type)} else {
assert_that(all(xg3_type %in%
Expand Down Expand Up @@ -410,11 +410,13 @@ eval_xg3_series <- function(data,
ser_rel_nryears = .data$ser_nryears / .data$ser_length,
ser_firstyear = min(.data$hydroyear),
ser_lastyear = max(.data$hydroyear),
ser_pval_uniform = disc_ks_test(.data$hydroyear,
ecdf(seq(.data$ser_firstyear,
.data$ser_lastyear)),
exact = TRUE) %>%
.$p.value
ser_pval_uniform = KSgeneral::disc_ks_test(
.data$hydroyear,
ecdf(seq(.data$ser_firstyear,
.data$ser_lastyear)),
exact = TRUE
) %>%
.$p.value
) %>%
ungroup
},
Expand Down Expand Up @@ -650,6 +652,8 @@ eval_chem <- function(data,
type = c("avail", "num", "both"),
uniformity_test = FALSE) {

require_pkgs("KSgeneral")

type <- match.arg(type)

assert_that(inherits(data, what = c("tbl_lazy", "data.frame")),
Expand Down Expand Up @@ -774,13 +778,15 @@ date, lab_sample_id, chem_variable, value, unit, below_loq."
df %>%
summarise(
nryears = sum(.data$available),
pval_uniform_totalspan = ifelse(.data$nryears > 0,
disc_ks_test(.data$year[.data$available],
ecdf(seq(firstyear,
lastyear)),
exact = TRUE) %>%
.$p.value,
NA)
pval_uniform_totalspan = ifelse(
.data$nryears > 0,
KSgeneral::disc_ks_test(.data$year[.data$available],
ecdf(seq(firstyear,
lastyear)),
exact = TRUE) %>%
.$p.value,
NA
)
) %>%
select(-.data$nryears) %>%
ungroup
Expand Down
4 changes: 2 additions & 2 deletions man/eval_chem.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/selectlocs_chem.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions man/watina-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.