Skip to content

Commit 1fd90d9

Browse files
committed
fix for check
1 parent aceddc6 commit 1fd90d9

10 files changed

+971
-964
lines changed

R/data.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ edc_example = function(N=50, seed=42, outdated=FALSE){
2020
x2 = .example_mixed(N, seed)
2121
x3 = .example_ae(N, seed)
2222
rtn = c(x1, x2, x3) %>%
23-
map(~{
23+
imap(~{
24+
if(.y=="long_pure") return(.x)
2425
.x %>%
2526
mutate(
2627
crfstat=sample(c("Complete","No Data","Incomplete"),

R/patient_gridplot.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
edc_patient_gridplot = function(sort_rows=TRUE, sort_cols=TRUE, gradient=FALSE,
3737
axes_flip=FALSE, show_grid=TRUE, preprocess=NULL,
3838
palette=c("Yes"="#00468BFF", "No"="#ED0000FF"),
39-
datasets=get_datasets(), lookup=get_lookup()){
39+
datasets=get_datasets(), lookup=edc_lookup()){
4040
subjid_cols = get_subjid_cols(lookup=lookup)
4141
if(is.null(preprocess)) preprocess=identity
4242
if(is_formula(preprocess)) preprocess=as_function(preprocess)

R/split_mixed.R

+7-5
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ table_format = function(df, id=get_subjid_cols(), ...,
8585
#' @examples
8686
#' #db = read_trialmaster("filename.zip", pw="xx")
8787
#' db = edc_example() %>%
88-
#' edc_split_mixed(c(ae, starts_with("long")))
88+
#' edc_split_mixed(c(ae, starts_with("long")),
89+
#' ignore_cols="crfstat")
8990
#'
9091
#' names(db)
9192
#' edc_lookup()
@@ -101,10 +102,11 @@ edc_split_mixed = function(database, datasets=everything(),
101102
check_dots_empty()
102103
.lookup = database$.lookup
103104
patient_id = get_subjid_cols(lookup=.lookup)
104-
105-
if(is.null(ignore_cols)){
106-
ignore_cols = c(get_crfname_cols(lookup=.lookup),
107-
get_meta_cols(lookup=.lookup, min_pct=0.95))
105+
106+
ignore_cols_default = c(get_crfname_cols(lookup=.lookup),
107+
get_meta_cols(lookup=.lookup, min_pct=0.95))
108+
if(!is.null(ignore_cols)){
109+
ignore_cols = c(ignore_cols_default, ignore_cols)
108110
}
109111

110112
db_mixed = database %>%

man/EDCimport-package.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/edc_patient_gridplot.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/edc_split_mixed.Rd

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/_snaps/patient_gridplot/edc-patient-gridplot-args.svg

+157-157
Loading

tests/testthat/_snaps/patient_gridplot/edc-patient-gridplot-default.svg

+396-396
Loading

tests/testthat/_snaps/patient_gridplot/edc-patient-gridplot-gradient.svg

+398-398
Loading

tests/testthat/test-split_mixed.R

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@ test_that("Split mixed", {
77
db = edc_example(N=100)
88

99
#all datasets
10-
mixed_data_all = edc_split_mixed(db, verbose=FALSE)
10+
mixed_data_all = edc_split_mixed(db, verbose=FALSE, ignore_cols="crfstat")
1111
expect_equal(edc_lookup(dataset)$dataset,
1212
c("ae", "ae_long", "ae_short", "data1", "data2", "data3", "enrol", "long_mixed",
1313
"long_mixed_long", "long_mixed_short", "long_pure", "short"))
1414

1515
#tidyselection
16-
mixed_data = edc_split_mixed(db, c(short, "enrol", starts_with("long")), verbose=FALSE)
16+
mixed_data = edc_split_mixed(db, datasets=c(short, "enrol", starts_with("long")),
17+
ignore_cols="crfstat", verbose=FALSE)
1718

1819
expect_equal(edc_lookup(dataset)$dataset,
1920
c("ae", "data1", "data2", "data3", "enrol", "long_mixed", "long_mixed_long",
2021
"long_mixed_short", "long_pure", "short"))
2122
expect_equal(nrow(mixed_data$long_mixed_short), 100)
2223
expect_equal(nrow(mixed_data$long_mixed_long), 200)
2324
expect_equal(ncol(mixed_data$long_mixed_short), 3)
24-
expect_equal(ncol(mixed_data$long_mixed_long), 3)
25+
expect_equal(ncol(mixed_data$long_mixed_long), 4)
2526

2627
#content
2728
expect_true(all(c("long_mixed_short", "long_mixed_long") %in% names(mixed_data)))
@@ -30,6 +31,6 @@ test_that("Split mixed", {
3031
expect_equal(nrow(mixed_data$long_mixed_short), 100)
3132
expect_equal(nrow(mixed_data$long_mixed_long), 200)
3233
expect_equal(ncol(mixed_data$long_mixed_short), 3)
33-
expect_equal(ncol(mixed_data$long_mixed_long), 3)
34+
expect_equal(ncol(mixed_data$long_mixed_long), 4)
3435

3536
})

0 commit comments

Comments
 (0)