From 8a7bef058d3bd0d4ba445fe3cf8fb77494592a3d Mon Sep 17 00:00:00 2001 From: adibender Date: Sat, 2 Feb 2019 21:08:59 +0100 Subject: [PATCH 01/15] test auto deploy with pkgdown --- .travis.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d6797ce1..9d9fbf49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,11 +23,9 @@ after_success: - Rscript -e 'covr::codecov(type="all", line_exclusions="R/zzz.R")' - Rscript -e 'pkgdown::build_site()' +before_deploy: Rscript -e 'remotes::install_cran("pkgdown")' deploy: - provider: pages - skip-cleanup: true github-token: $GITHUB_PAT - keep-history: false - local-dir: docs - on: - branch: master + provider: script + script: Rscript -e 'pkgdown::deploy_site_github()' + skip_cleanup: true From d1db425e5c251d2973218344b4170e4dfd8bd61e Mon Sep 17 00:00:00 2001 From: adibender Date: Sat, 2 Feb 2019 21:21:44 +0100 Subject: [PATCH 02/15] deploy pkgdown on devel branch --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 9d9fbf49..5aa37ab0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,3 +29,7 @@ deploy: provider: script script: Rscript -e 'pkgdown::deploy_site_github()' skip_cleanup: true + on: + branch: + - master + - devel From 651a58c5f973a36c0e124dc1e292b7a0ae1ca19c Mon Sep 17 00:00:00 2001 From: adibender Date: Sat, 2 Feb 2019 21:40:27 +0100 Subject: [PATCH 03/15] another pkgdown deploy test --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5aa37ab0..7c9b53ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ r_github_packages: branches: only: - master + - devel after_success: - Rscript -e 'covr::codecov(type="all", line_exclusions="R/zzz.R")' @@ -29,7 +30,3 @@ deploy: provider: script script: Rscript -e 'pkgdown::deploy_site_github()' skip_cleanup: true - on: - branch: - - master - - devel From c29946efc066e76aec0bf32f4285187cffc097ab Mon Sep 17 00:00:00 2001 From: adibender Date: Sat, 2 Feb 2019 22:14:01 +0100 Subject: [PATCH 04/15] reset travis, minor hp tweak --- .travis.yml | 11 ++++++----- _pkgdown.yml | 4 +--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7c9b53ef..d6797ce1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,15 +18,16 @@ r_github_packages: branches: only: - master - - devel after_success: - Rscript -e 'covr::codecov(type="all", line_exclusions="R/zzz.R")' - Rscript -e 'pkgdown::build_site()' -before_deploy: Rscript -e 'remotes::install_cran("pkgdown")' deploy: + provider: pages + skip-cleanup: true github-token: $GITHUB_PAT - provider: script - script: Rscript -e 'pkgdown::deploy_site_github()' - skip_cleanup: true + keep-history: false + local-dir: docs + on: + branch: master diff --git a/_pkgdown.yml b/_pkgdown.yml index 4200300d..e673cbe3 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -18,9 +18,6 @@ reference: - int_info - ped_info - make_newdata - - gg_slice - - gg_partial - - get_cumu_eff - title: "Extract information from PAMMs" desc: "Functions that help extract information from fitted model objects, e.g., smooth effects for plotting" @@ -44,6 +41,7 @@ reference: - gg_smooth - gg_tensor - gg_re + - gg_slice - gg_partial - gg_partial_ll - gg_laglead From 3f57b2986fc36287184fae7eaf24afb76e3ccbda Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Sat, 9 Mar 2019 15:46:43 +0000 Subject: [PATCH 05/15] Remove sample dependency #95 --- tests/testthat/test-cumulative-coefficients.R | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/testthat/test-cumulative-coefficients.R b/tests/testthat/test-cumulative-coefficients.R index 99ed6897..11c0b3f6 100644 --- a/tests/testthat/test-cumulative-coefficients.R +++ b/tests/testthat/test-cumulative-coefficients.R @@ -1,34 +1,33 @@ context("Test cumulative coefficients functionality") test_that("Cumulative coefficients work", { + data("tumor") - set.seed(123) - tumor <- tumor %>% dplyr::sample_n(100) + + # PAMs + tumor <- tumor %>% dplyr::slice(1:100) tumor_ped <- tumor %>% as_ped( formula = Surv(days, status) ~ age + complications) pam <- mgcv::gam( formula = ped_status ~ s(tend, by = as.ordered(complications)) + s(tend, by = age), data = tumor_ped, family = poisson(), offset = offset) - expect_warning(bam <- mgcv::bam( - formula = ped_status ~ s(tend, by = as.ordered(complications)) + - s(tend, by = age), - data = tumor_ped, family = poisson(), offset = offset, method = "REML")) - cumu_coef_bam <- get_cumu_coef(bam, tumor_ped, + cumu_coef <- get_cumu_coef(pam, tumor_ped, terms = c("age", "complications")) - expect_data_frame(cumu_coef_bam, nrows = 100, ncols = 6) + expect_data_frame(cumu_coef, nrows = 82L, ncols = 6L) cumu_coef_pam <- get_cumu_coef(pam, tumor_ped, terms = c("(Intercept)", "age")) - expect_data_frame(cumu_coef_pam, nrows = 100, ncols = 6) + expect_data_frame(cumu_coef_pam, nrows = 82L, ncols = 6L) + ## aalen model library(timereg) aalen <- aalen(Surv(days, status)~ age + complications, data = tumor) cumu_coef_aalen <- get_cumu_coef(aalen, terms = c("age", "complications")) - expect_data_frame(cumu_coef_aalen, nrows = 104L, ncols = 6L) + expect_data_frame(cumu_coef_aalen, nrows = 86L, ncols = 6L) # cox aalen cox.aalen <- cox.aalen(Surv(days, status) ~ age + prop(complications), data = tumor) cumu_coef_cox.aalen <- get_cumu_coef(cox.aalen, terms = c("age")) - expect_data_frame(cumu_coef_cox.aalen, nrows = 52, ncols = 6L) + expect_data_frame(cumu_coef_cox.aalen, nrows = 43, ncols = 6L) }) From e69552811d2d9f88587faff7cb0ae9b1feff0e2b Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Sat, 9 Mar 2019 16:06:51 +0000 Subject: [PATCH 06/15] Fix #95 --- DESCRIPTION | 4 +- NAMESPACE | 1 + man/tidyr_verbs.Rd | 9 ++- tests/testthat/test-add-functions.R | 3 + tests/testthat/test-cumulative-effect.R | 3 +- tests/testthat/test-newdata.R | 74 +++++++++++++------------ tests/testthat/test-simulation.R | 2 + 7 files changed, 53 insertions(+), 43 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a1d2b4a6..7fb719a2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: pammtools Title: Piece-Wise Exponential Additive Mixed Modeling Tools -Version: 0.1.8.9001 +Version: 0.1.8.9002 Date: 2018-12-23 Authors@R: c( person("Andreas", "Bender", , "andreas.bender@stat.uni-muenchen.de", role = c("aut", "cre"), comment=c(ORCID = "0000-0001-5628-8611")), @@ -16,7 +16,7 @@ Description: The Piece-wise exponential (Additive Mixed) Model including data transformation and other pre- and post-processing functions as well as visualization. Depends: - R (>= 3.3.0) + R (>= 3.3.1) Imports: mgcv, survival (>= 2.39-5), diff --git a/NAMESPACE b/NAMESPACE index d231492b..f10ff010 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -60,6 +60,7 @@ S3method(select_,nested_fdf) S3method(select_,ped) S3method(slice,nested_fdf) S3method(slice,ped) +S3method(smooth.construct,fdl.smooth.spec) S3method(summarise,nested_fdf) S3method(summarise,ped) S3method(summarize,nested_fdf) diff --git a/man/tidyr_verbs.Rd b/man/tidyr_verbs.Rd index a3f18418..f692505f 100644 --- a/man/tidyr_verbs.Rd +++ b/man/tidyr_verbs.Rd @@ -17,11 +17,10 @@ \arguments{ \item{data}{an object of class \code{ped}, see \code{\link{as_ped}}.} -\item{...}{A selection of columns. If empty, all variables are -selected. You can supply bare variable names, select all -variables between x and z with \code{x:z}, exclude y with \code{-y}. For -more options, see the \code{\link[dplyr:select]{dplyr::select()}} documentation. See also -the section on selection rules below.} +\item{...}{A selection of columns. If empty, nothing happens. You can +supply bare variable names, select all variables between \code{x} and \code{z} +with \code{x:z}, exclude \code{y} with \code{-y}. For more selection options, see the +\code{\link[dplyr:select]{dplyr::select()}} documentation.} \item{.direction}{Direction in which to fill missing values. Currently either "down" (the default) or "up".} diff --git a/tests/testthat/test-add-functions.R b/tests/testthat/test-add-functions.R index cba62da4..43a454e6 100644 --- a/tests/testthat/test-add-functions.R +++ b/tests/testthat/test-add-functions.R @@ -87,6 +87,7 @@ test_that("cumulative hazard functions work for PAM", { expect_equal(round(haz2$cumu_upper, 2), c(.58, 1.09, 1.94, 2.72, 3.48)) expect_equal(round(haz2$cumu_lower, 2), c(.36, .71, 1.34, 1.82, 2.14)) + suppressWarnings(RNGversion("3.5.0")) ## sim CI (0.95) set.seed(123) haz3 <- ped_info(ped) %>% add_cumu_hazard(pam, ci_type = "sim") @@ -173,6 +174,8 @@ test_that("works for nonstandard baseline arguments", { ## test surv_prob test_that("survival probabilities functions work for PAM", { + suppressWarnings(RNGversion("3.5.0")) + expect_data_frame(add_surv_prob(ped_info(ped), bam, ci = FALSE), nrows = 5L, ncols = 8L) expect_data_frame(surv <- add_surv_prob(ped_info(ped), pam, ci = FALSE), diff --git a/tests/testthat/test-cumulative-effect.R b/tests/testthat/test-cumulative-effect.R index 20d7bbb9..cff3be97 100644 --- a/tests/testthat/test-cumulative-effect.R +++ b/tests/testthat/test-cumulative-effect.R @@ -58,8 +58,9 @@ test_that("LL helpers and as_ped produce equivalent LL windows", { }) test_that("Cumulative effects are calculated correctly", { - # tz grid with differences different than 1 + suppressWarnings(RNGversion("3.5.0")) + # tz grid with differences different than 1 # generate exposures and add to data set n <- 250 set.seed(123) diff --git a/tests/testthat/test-newdata.R b/tests/testthat/test-newdata.R index 7281577a..4782870d 100644 --- a/tests/testthat/test-newdata.R +++ b/tests/testthat/test-newdata.R @@ -1,39 +1,45 @@ context("create newdata") - test_that("creating newdata works on ungrouped data", { - set.seed(123) - iris2 <- iris %>% group_by(Species) %>% sample_n(2) %>% ungroup() - - expect_data_frame(make_newdata(iris2), any.missing=FALSE, nrows=1, ncols=5) - expect_equal(colnames(make_newdata(iris2)), colnames(iris2)) - expect_data_frame(make_newdata(iris2, Sepal.Length=c(5)), any.missing=FALSE, - nrows=1, ncols=5) - expect_equal(make_newdata(iris2, Sepal.Length=c(5))$Sepal.Length, 5) - expect_data_frame(make_newdata(iris2, Sepal.Length=c(5, 6)), - any.missing=FALSE, nrows=2, ncols=5) - expect_data_frame(make_newdata(iris2, Sepal.Length=seq_range(Sepal.Length, 2)), - any.missing=FALSE, nrows=2, ncols=5) - expect_equal(make_newdata(iris2, Sepal.Length=seq_range(Sepal.Length, 2))$Sepal.Length, - c(4.4, 7.1)) + + iris2 <- iris %>% group_by(Species) %>% slice(1:2) %>% ungroup() + expect_data_frame( + make_newdata(iris2), + any.missing = FALSE, nrows = 1L, ncols = 5L) + expect_equal(colnames(make_newdata(iris2)), colnames(iris2)) + expect_data_frame( + make_newdata(iris2, Sepal.Length = c(5)), + any.missing = FALSE, nrows = 1L, ncols = 5L) + expect_equal(make_newdata(iris2, Sepal.Length = c(5))$Sepal.Length, 5) + expect_data_frame( + make_newdata(iris2, Sepal.Length = c(5, 6)), + any.missing = FALSE, nrows = 2L, ncols = 5L) + expect_data_frame( + make_newdata(iris2, Sepal.Length = seq_range(Sepal.Length, 2)), + any.missing = FALSE, nrows = 2L, ncols = 5L) + expect_equal( + make_newdata(iris2, Sepal.Length = seq_range(Sepal.Length, 2))$Sepal.Length, + c(4.9, 7.0)) }) test_that("creating newdata fails on ungrouped data", { - set.seed(123) - iris2 <- iris %>% group_by(Species) %>% sample_n(2) %>% ungroup() - expect_warning(make_newdata(iris2, Sepal.length=c(5))) - expect_error(make_newdata(iris2, Sepal.Length=5)) - expect_error(make_newdata(iris2, Sepal.Length=seq_range(Sepal.length, 2))) - expect_warning(make_newdata(iris2, Sepal.length=seq_range(Sepal.Length, 2))) + iris2 <- iris %>% group_by(Species) %>% slice(2) %>% ungroup() + + expect_warning(make_newdata(iris2, Sepal.length = c(5))) + expect_error(make_newdata(iris2, Sepal.Length = 5)) + expect_error(make_newdata(iris2, Sepal.Length = seq_range(Sepal.length, 2))) + expect_warning(make_newdata(iris2, Sepal.length = seq_range(Sepal.Length, 2))) }) test_that("make_newdata works for PED data", { - ped <- simdf_elra %>% slice(1:6) %>% as_ped(Surv(time, status)~x1 + x2, - cut = seq(0, 10, by = 5)) + + ped <- simdf_elra %>% + slice(1:6) %>% + as_ped(Surv(time, status)~x1 + x2, cut = seq(0, 10, by = 5)) mdf <- ped %>% make_newdata(x1 = seq_range(x1, 2)) expect_data_frame(mdf, nrows = 2L, ncols = 9L) expect_equal(mdf$tend, c(5, 5)) @@ -51,23 +57,21 @@ test_that("make_newdata works for PED data", { test_that("make_newdata works for PED with matrix columns", { # library(mgcv) ped_simdf <- simdf_elra %>% as_ped( - Surv(time, status)~ x1 + x2| - cumulative(time, latency(tz1), z.tz1, tz_var="tz1", - ll_fun=function(t, tz) {t >= tz + 2}) + - cumulative(latency(tz2), z.tz2, tz_var="tz2"), + Surv(time, status)~ x1 + x2 | + cumulative(time, latency(tz1), z.tz1, tz_var = "tz1", + ll_fun = function(t, tz) t >= tz + 2) + + cumulative(latency(tz2), z.tz2, tz_var = "tz2"), cut = 0:10) ## sample info - expect_data_frame(sdf <- sample_info(ped_simdf), nrows=1, ncols=2) + expect_data_frame(sdf <- sample_info(ped_simdf), nrows = 1, ncols = 2) expect_equal(sdf$x1, 0.0718, tolerance = 1e-3) expect_equal(sdf$x2, 3.043, tolerance = 1e-3) - # expect_equal(sdf$z.tz1_tz1, -0.370, tolerance = 1e-3) - # expect_equal(sdf$z.tz2_tz2, -0.370, tolerance = ) ## ped info pinf <- ped_info(ped_simdf) expect_data_frame(pinf, nrows = 10L, ncols = 7L) - expect_equal(pinf$x1[1], 0.0718, tolerance=1e-3) + expect_equal(pinf$x1[1], 0.0718, tolerance = 1e-3) expect_equal(pinf$x2[2], 3.043, tolerance = 1e-3) # make newdata @@ -92,16 +96,16 @@ test_that("make_newdata works for PED with matrix columns", { expect_data_frame(nd4, nrows = 6L, ncols = 16L) expect_equal(nd4$tz1_latency, 0:5) - nd5 <- ped_simdf %>% make_newdata(tend=c(1:10), tz1_latency=seq(1:5)) + nd5 <- ped_simdf %>% make_newdata(tend = c(1:10), tz1_latency = seq(1:5)) expect_data_frame(nd5, nrows = 50L, ncols = 16L) - expect_equal(nd5$tend, rep(1:10, 5)) - expect_equal(nd5$tz1_latency, rep(1:5, each=10)) + expect_equal(nd5$tend, rep(1:10, 5L)) + expect_equal(nd5$tz1_latency, rep(1:5, each = 10L)) expect_equal(nd5$LL_tz1, c(rep(0, 10), rep(1, nrow(nd5) - 10))) }) test_that("Errors are thrown", { - expect_error(combine_df(data.frame(x=1), x=2)) + expect_error(combine_df(data.frame(x = 1), x = 2)) }) diff --git a/tests/testthat/test-simulation.R b/tests/testthat/test-simulation.R index 14cf7e51..4682bb8b 100644 --- a/tests/testthat/test-simulation.R +++ b/tests/testthat/test-simulation.R @@ -2,6 +2,8 @@ context("Test simulation functions") test_that("Simulation function works", { + suppressWarnings(RNGversion("3.5.0")) + set.seed(24032018) # standard data df <- cbind.data.frame(x1 = runif (3, -3, 3), x2 = runif (3, 0, 6)) From 63ba66db2a347ed0df1c06fb82888fb7a5c372ec Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Sat, 9 Mar 2019 16:17:29 +0000 Subject: [PATCH 07/15] Fix NAMESPACE --- NAMESPACE | 1 - 1 file changed, 1 deletion(-) diff --git a/NAMESPACE b/NAMESPACE index f10ff010..d231492b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -60,7 +60,6 @@ S3method(select_,nested_fdf) S3method(select_,ped) S3method(slice,nested_fdf) S3method(slice,ped) -S3method(smooth.construct,fdl.smooth.spec) S3method(summarise,nested_fdf) S3method(summarise,ped) S3method(summarize,nested_fdf) From b116c0a88b8ad83bdee8207f4bb5f942e6da321a Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Sat, 9 Mar 2019 16:19:03 +0000 Subject: [PATCH 08/15] Fix description --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7fb719a2..070153d3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,7 @@ Description: The Piece-wise exponential (Additive Mixed) Model including data transformation and other pre- and post-processing functions as well as visualization. Depends: - R (>= 3.3.1) + R (>= 3.3.0) Imports: mgcv, survival (>= 2.39-5), From 3c115833bb6cd0fd6decf1b276c5c9c975407ed1 Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Fri, 15 Mar 2019 15:43:13 +0000 Subject: [PATCH 09/15] Fix typo in news file --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 9079d0ad..583598a4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -26,7 +26,7 @@ * Updates homepage (via pkgdown) -# pamtools 0.1.3 +# pammtools 0.1.3 ## Minor changes From 24bb5931c6bdb18193d2d7e87701ff98394527d4 Mon Sep 17 00:00:00 2001 From: adibender Date: Sat, 16 Mar 2019 11:42:27 +0100 Subject: [PATCH 10/15] man page update Signed-off-by: adibender --- man/tidyr_verbs.Rd | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/man/tidyr_verbs.Rd b/man/tidyr_verbs.Rd index f692505f..a3f18418 100644 --- a/man/tidyr_verbs.Rd +++ b/man/tidyr_verbs.Rd @@ -17,10 +17,11 @@ \arguments{ \item{data}{an object of class \code{ped}, see \code{\link{as_ped}}.} -\item{...}{A selection of columns. If empty, nothing happens. You can -supply bare variable names, select all variables between \code{x} and \code{z} -with \code{x:z}, exclude \code{y} with \code{-y}. For more selection options, see the -\code{\link[dplyr:select]{dplyr::select()}} documentation.} +\item{...}{A selection of columns. If empty, all variables are +selected. You can supply bare variable names, select all +variables between x and z with \code{x:z}, exclude y with \code{-y}. For +more options, see the \code{\link[dplyr:select]{dplyr::select()}} documentation. See also +the section on selection rules below.} \item{.direction}{Direction in which to fill missing values. Currently either "down" (the default) or "up".} From 0b9cde5f44b60567431c6d3bcf56c3ffbe173e55 Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Wed, 17 Apr 2019 12:03:51 +0100 Subject: [PATCH 11/15] Fixes #101 --- R/cumulative-coefficient.R | 8 ++++++-- tests/testthat/test-cumulative-coefficients.R | 12 ++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/R/cumulative-coefficient.R b/R/cumulative-coefficient.R index b66287af..eef37365 100644 --- a/R/cumulative-coefficient.R +++ b/R/cumulative-coefficient.R @@ -128,10 +128,14 @@ cumu_coef <- function(data, model, term, ...) { #' @inherit get_cumu_coef #' @keywords internal get_cumu_coef_baseline <- function(data, model, ...) { + + vars_modify <- colnames(data)[map_lgl(data, is.numeric)] %>% + setdiff(c("tstart", "tend", "intlen", "intmid")) + data %>% mutate_at( - .vars = vars(-one_of(c("tstart", "tend", "intlen", "intmid", "interval"))), - .funs = ~0) %>% + .vars = vars(one_of(vars_modify)), + .funs = ~c(0)) %>% add_cumu_hazard(model) %>% mutate( method = class(model)[1], diff --git a/tests/testthat/test-cumulative-coefficients.R b/tests/testthat/test-cumulative-coefficients.R index d918fe04..2e842cf9 100644 --- a/tests/testthat/test-cumulative-coefficients.R +++ b/tests/testthat/test-cumulative-coefficients.R @@ -17,10 +17,18 @@ test_that("Cumulative coefficients work", { ## pam ped <- as_ped(df, formula = Surv(days, status)~ x1 + age) - pam <- mgcv::gam(ped_status ~ x1 + age, data = ped, family = poisson(), - offset = offset) + pam <- mgcv::gam(ped_status ~ s(tend) + x1 + age, data = ped, + family = poisson(), offset = offset) cumu_coef_pam <- get_cumu_coef(pam, ped, terms = c("age", "x1"), nsim = 20L) expect_data_frame(cumu_coef_pam, nrows = 36L, ncols = 6L) expect_equal(unique(cumu_coef_pam$variable), c("age", "x1 (b)", "x1 (c)")) + cumu_coef_pam <- get_cumu_coef(pam, ped, terms = c("(Intercept)", "age")) + expect_data_frame(cumu_coef_pam, nrows = 24L, ncols = 6L) + # ggplot( + # filter(cc2, variable == "(Intercept)"), + # aes(x = time, y = cumu_hazard)) + + # geom_step() + + # geom_step(data = filter(cumu_coef_aalen, variable == "(Intercept)"), col = 2) + }) From ee9b98ab5325a5ed350b2f281eb4dab7594521fd Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Wed, 17 Apr 2019 12:15:12 +0100 Subject: [PATCH 12/15] Update News and Description --- DESCRIPTION | 2 +- NEWS.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 465c07ea..7516a6fa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: pammtools Title: Piece-Wise Exponential Additive Mixed Modeling Tools Version: 0.1.11 -Date: 2019-03-28 +Date: 2019-04-17 Authors@R: c( person("Andreas", "Bender", , "andreas.bender@stat.uni-muenchen.de", role = c("aut", "cre"), comment=c(ORCID = "0000-0001-5628-8611")), person("Fabian", "Scheipl", , "fabian.scheipl@stat.uni-muenchen.de", role = c("aut"))) diff --git a/NEWS.md b/NEWS.md index 9079d0ad..7962eabd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,13 @@ +# pammtools 0.1.11 + +## bugs +* fixes bug in **`dplyr` reverse dependency (see #101) +* fixes bug in tidiers for Aalen models (see #99) + +## documentation +* Better documentation and functionality for `make_newdata` +* Added new vignette linking to tutorial paper (online only) + # pammtools 0.1.9 * maintainance update: fixes CRAN issues due to new RNG From f845a91eb344c020887493058ededc7f17246f05 Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Wed, 17 Apr 2019 12:18:10 +0100 Subject: [PATCH 13/15] Update cran comments --- cran-comments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cran-comments.md b/cran-comments.md index 26232fa0..06bcd078 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -8,7 +8,7 @@ 0 errors | 0 warnings | 0 notes -* maintainance update: fixes CRAN issues due to new RNG +* Fixes dplyr reverse dependency bug + documentation updates ## Reverse dependencies From a86ac13f4a466125d2485e9ea01ece4d231eb8cc Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Wed, 17 Apr 2019 13:13:36 +0100 Subject: [PATCH 14/15] Remove underscore versions of dplyr verbs --- R/tidyverse-methods.R | 71 ++++--------------------------------------- man/dplyr_verbs.Rd | 21 ------------- man/tidyr_verbs.Rd | 9 +++--- 3 files changed, 10 insertions(+), 91 deletions(-) diff --git a/R/tidyverse-methods.R b/R/tidyverse-methods.R index 22876f92..aed44675 100644 --- a/R/tidyverse-methods.R +++ b/R/tidyverse-methods.R @@ -79,13 +79,6 @@ ungroup.ped <- function(x, ...) { #------------------------------------------------------------------------------- # single table: row ops -#' @export -#' @export distinct_ -#' @rdname dplyr_verbs -distinct_.ped <- function(.data, ..., .dots = list()) { - reped(distinct_(unped(.data), ..., .dots = .dots)) -} - #' @export #' @export filter #' @rdname dplyr_verbs @@ -128,13 +121,6 @@ select.ped <- function(.data, ...) { reped(select(unped(.data), ...)) } -#' @export -#' @export select_ -#' @rdname dplyr_verbs -select_.ped <- function(.data, ..., .dots = list()) { - reped(select_(unped(.data), ..., .dots = .dots)) -} - #' @param keep_attributes conserve attributes? defaults to \code{TRUE} #' @export #' @export mutate @@ -157,13 +143,6 @@ rename.ped <- function(.data, ...) { reped(rename(unped(.data), ...)) } -#' @export -#' @export rename_ -#' @rdname dplyr_verbs -rename_.ped <- function(.data, ..., .dots = list()) { - reped(rename_(unped(.data), ..., .dots = .dots)) -} - #' @export #' @export summarise #' @rdname dplyr_verbs @@ -275,21 +254,6 @@ fill.ped <- function(data, ..., .direction=c("down", "up"), keep_attributes=TRUE } -# #' @inheritParams tidyr::fill_ -# #' @export fill_ -# #' @export -# #' @rdname tidyr_verbs -# fill_.ped <- function(data, fill_cols, .direction=c("down", "up")) { - -# data_attr <- ped_attr(data) -# tbl <- reped(fill_(unped(data), fill_cols, .direction)) -# attributes(tbl) <- c(attributes(tbl), data_attr) - -# return(tbl) - -# } - - #' @importFrom purrr discard un_nested_df <- function(nested_fdf) { class(nested_fdf) <- class(nested_fdf) %>% discard(~.=="nested_fdf") @@ -322,14 +286,6 @@ group_by.nested_fdf <- function(.data, ..., add = FALSE) { re_nested_df(group_by(un_nested_df(.data), ..., add = add)) } -#' @inheritParams dplyr::group_by_ -#' @export -#' @export group_by_ -#' @rdname dplyr_verbs -group_by_.nested_fdf <- function(.data, ..., .dots = list(), add = FALSE) { - re_nested_df(group_by_(un_nested_df(.data), ..., .dots = .dots, add = add)) -} - #' @export #' @export ungroup #' @rdname dplyr_verbs @@ -340,13 +296,6 @@ ungroup.nested_fdf <- function(x, ...) { #------------------------------------------------------------------------------- # single table: row ops -#' @export -#' @export distinct_ -#' @rdname dplyr_verbs -distinct_.nested_fdf <- function(.data, ..., .dots = list()) { - re_nested_df(distinct_(un_nested_df(.data), ..., .dots = .dots)) -} - #' @export #' @export filter #' @rdname dplyr_verbs @@ -389,12 +338,6 @@ select.nested_fdf <- function(.data, ...) { re_nested_df(select(un_nested_df(.data), ...)) } -#' @export -#' @export select_ -#' @rdname dplyr_verbs -select_.nested_fdf <- function(.data, ..., .dots = list()) { - re_nested_df(select_(un_nested_df(.data), ..., .dots = .dots)) -} #' @param keep_attributes conserve attributes? defaults to \code{TRUE} #' @export @@ -418,12 +361,6 @@ rename.nested_fdf <- function(.data, ...) { re_nested_df(rename(un_nested_df(.data), ...)) } -#' @export -#' @export rename_ -#' @rdname dplyr_verbs -rename_.nested_fdf <- function(.data, ..., .dots = list()) { - re_nested_df(rename_(un_nested_df(.data), ..., .dots = .dots)) -} #' @export #' @export summarise @@ -515,11 +452,15 @@ right_join.nested_fdf <- function(x, y, by = NULL, copy = FALSE, suffix = c(".x" #' @export fill #' @rdname tidyr_verbs #' @keywords internal -fill.nested_fdf <- function(data, ..., .direction=c("down", "up"), keep_attributes=TRUE) { +fill.nested_fdf <- function( + data, + ..., + .direction = c("down", "up"), + keep_attributes = TRUE) { if (keep_attributes) { data_attr <- nested_fdf_attr(data) } - tbl <- re_nested_df(fill(un_nested_df(data), ..., .direction=.direction)) + tbl <- re_nested_df(fill(un_nested_df(data), ..., .direction = .direction)) if (keep_attributes) { attributes(tbl) <- c(attributes(tbl), data_attr) } diff --git a/man/dplyr_verbs.Rd b/man/dplyr_verbs.Rd index a138e33d..68427d09 100644 --- a/man/dplyr_verbs.Rd +++ b/man/dplyr_verbs.Rd @@ -26,16 +26,13 @@ \alias{group_by.ped} \alias{group_by_.ped} \alias{ungroup.ped} -\alias{distinct_.ped} \alias{filter.ped} \alias{sample_n.ped} \alias{sample_frac.ped} \alias{slice.ped} \alias{select.ped} -\alias{select_.ped} \alias{mutate.ped} \alias{rename.ped} -\alias{rename_.ped} \alias{summarise.ped} \alias{summarize.ped} \alias{transmute.ped} @@ -45,18 +42,14 @@ \alias{right_join.ped} \alias{arrange.nested_fdf} \alias{group_by.nested_fdf} -\alias{group_by_.nested_fdf} \alias{ungroup.nested_fdf} -\alias{distinct_.nested_fdf} \alias{filter.nested_fdf} \alias{sample_n.nested_fdf} \alias{sample_frac.nested_fdf} \alias{slice.nested_fdf} \alias{select.nested_fdf} -\alias{select_.nested_fdf} \alias{mutate.nested_fdf} \alias{rename.nested_fdf} -\alias{rename_.nested_fdf} \alias{summarise.nested_fdf} \alias{summarize.nested_fdf} \alias{transmute.nested_fdf} @@ -74,8 +67,6 @@ \method{ungroup}{ped}(x, ...) -\method{distinct_}{ped}(.data, ..., .dots = list()) - \method{filter}{ped}(.data, ...) \method{sample_n}{ped}(tbl, size, replace = FALSE, weight = NULL, @@ -88,14 +79,10 @@ \method{select}{ped}(.data, ...) -\method{select_}{ped}(.data, ..., .dots = list()) - \method{mutate}{ped}(.data, ..., keep_attributes = TRUE) \method{rename}{ped}(.data, ...) -\method{rename_}{ped}(.data, ..., .dots = list()) - \method{summarise}{ped}(.data, ...) \method{summarize}{ped}(.data, ...) @@ -118,12 +105,8 @@ \method{group_by}{nested_fdf}(.data, ..., add = FALSE) -\method{group_by_}{nested_fdf}(.data, ..., .dots = list(), add = FALSE) - \method{ungroup}{nested_fdf}(x, ...) -\method{distinct_}{nested_fdf}(.data, ..., .dots = list()) - \method{filter}{nested_fdf}(.data, ...) \method{sample_n}{nested_fdf}(tbl, size, replace = FALSE, @@ -136,14 +119,10 @@ \method{select}{nested_fdf}(.data, ...) -\method{select_}{nested_fdf}(.data, ..., .dots = list()) - \method{mutate}{nested_fdf}(.data, ..., keep_attributes = TRUE) \method{rename}{nested_fdf}(.data, ...) -\method{rename_}{nested_fdf}(.data, ..., .dots = list()) - \method{summarise}{nested_fdf}(.data, ...) \method{summarize}{nested_fdf}(.data, ...) diff --git a/man/tidyr_verbs.Rd b/man/tidyr_verbs.Rd index a3f18418..f692505f 100644 --- a/man/tidyr_verbs.Rd +++ b/man/tidyr_verbs.Rd @@ -17,11 +17,10 @@ \arguments{ \item{data}{an object of class \code{ped}, see \code{\link{as_ped}}.} -\item{...}{A selection of columns. If empty, all variables are -selected. You can supply bare variable names, select all -variables between x and z with \code{x:z}, exclude y with \code{-y}. For -more options, see the \code{\link[dplyr:select]{dplyr::select()}} documentation. See also -the section on selection rules below.} +\item{...}{A selection of columns. If empty, nothing happens. You can +supply bare variable names, select all variables between \code{x} and \code{z} +with \code{x:z}, exclude \code{y} with \code{-y}. For more selection options, see the +\code{\link[dplyr:select]{dplyr::select()}} documentation.} \item{.direction}{Direction in which to fill missing values. Currently either "down" (the default) or "up".} From 1eacb0185a91c39ed9607f6c51c6523edad0845a Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Wed, 17 Apr 2019 13:14:02 +0100 Subject: [PATCH 15/15] Update news, comments, etc --- NAMESPACE | 10 ---------- NEWS.md | 2 +- cran-comments.md | 5 +++-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index ba487548..22018dcd 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -5,8 +5,6 @@ S3method(arrange,ped) S3method(as_ped,data.frame) S3method(as_ped,list) S3method(as_ped,nested_fdf) -S3method(distinct_,nested_fdf) -S3method(distinct_,ped) S3method(fill,nested_fdf) S3method(fill,ped) S3method(filter,nested_fdf) @@ -25,7 +23,6 @@ S3method(gg_laglead,nested_fdf) S3method(gg_smooth,default) S3method(group_by,nested_fdf) S3method(group_by,ped) -S3method(group_by_,nested_fdf) S3method(group_by_,ped) S3method(inner_join,nested_fdf) S3method(inner_join,ped) @@ -43,8 +40,6 @@ S3method(nest_tdc,default) S3method(nest_tdc,list) S3method(rename,nested_fdf) S3method(rename,ped) -S3method(rename_,nested_fdf) -S3method(rename_,ped) S3method(right_join,nested_fdf) S3method(right_join,ped) S3method(sample_frac,nested_fdf) @@ -56,8 +51,6 @@ S3method(sample_n,nested_fdf) S3method(sample_n,ped) S3method(select,nested_fdf) S3method(select,ped) -S3method(select_,nested_fdf) -S3method(select_,ped) S3method(slice,nested_fdf) S3method(slice,ped) S3method(summarise,nested_fdf) @@ -85,7 +78,6 @@ export(arrange) export(as_ped) export(combine_df) export(cumulative) -export(distinct_) export(fcumu) export(fill) export(filter) @@ -121,14 +113,12 @@ export(mutate) export(nest_tdc) export(ped_info) export(rename) -export(rename_) export(right_join) export(riskset_info) export(sample_frac) export(sample_info) export(sample_n) export(select) -export(select_) export(seq_range) export(sim_pexp) export(slice) diff --git a/NEWS.md b/NEWS.md index 06aca0d2..0fe163cd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,7 @@ # pammtools 0.1.11 ## bugs -* fixes bug in **`dplyr` reverse dependency (see #101) +* fixes bug in **`dplyr`** reverse dependency (see #101) * fixes bug in tidiers for Aalen models (see #99) ## documentation diff --git a/cran-comments.md b/cran-comments.md index 06bcd078..53fe2842 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,7 +1,8 @@ ## Test environments * R release and devel with Travis CI -* R 3.5.2 patched with appveyor -* win-builder (devel and release) +* R 3.5.3 patched with AppVeyor +* win-builder (R version 3.6.0 beta (2019-04-16 r76403)) +* win-builder * R-hub ## R CMD check results