From 7f630f74efb657a7d9dd0e54d4954e570373a3ef Mon Sep 17 00:00:00 2001 From: Kai Gu Date: Wed, 22 May 2024 23:46:47 +0800 Subject: [PATCH] fix the issue37 --- R/data.R | 18 +++++++++++++++ R/summarize-lsmeans.R | 3 +++ data-raw/high1.sas7bdat | Bin 0 -> 37888 bytes data-raw/low1.sas7bdat | Bin 0 -> 50176 bytes data-raw/low_high.R | 5 ++++ data/high1.rda | Bin 0 -> 2371 bytes data/low1.rda | Bin 0 -> 2231 bytes man/missing_data.Rd | 29 ++++++++++++++++++++++++ tests/testthat/test-summarize-lsmeans.R | 12 ++++++++++ 9 files changed, 67 insertions(+) create mode 100644 data-raw/high1.sas7bdat create mode 100644 data-raw/low1.sas7bdat create mode 100644 data-raw/low_high.R create mode 100644 data/high1.rda create mode 100644 data/low1.rda create mode 100644 man/missing_data.Rd diff --git a/R/data.R b/R/data.R index 79e27be..3d1307e 100644 --- a/R/data.R +++ b/R/data.R @@ -46,3 +46,21 @@ #' @rdname cdisc_random_data "rand_adae" + +#' Example Datasets with low and high dropout +#' +#' @description `r lifecycle::badge("experimental")` +#' +#' These two datasets are from Mallinckrodt et al. +#' (https://journals.sagepub.com/doi/pdf/10.1177/2168479013501310) which is available +#' via (https://www.lshtm.ac.uk/research/centres-projects-groups/missing-data#dia-missing-data). +#' The original data were from 2 nearly identically designed antidepressant clinical +#' trials that were originally reported by Goldstein et al and Detke et al. +#' Assessments on the Hamilton 17-item rating scale for depression (HAMD17)19 were +#' taken at baseline and weeks 1, 2, 4, 6, and 8 in each trial. +#' +#' @rdname missing_data +"low1" + +#' @rdname missing_data +"high1" diff --git a/R/summarize-lsmeans.R b/R/summarize-lsmeans.R index 3eed71c..ec7fe5c 100644 --- a/R/summarize-lsmeans.R +++ b/R/summarize-lsmeans.R @@ -142,6 +142,9 @@ s_get_lsmeans <- function(object, data.frame(emmeans::test(contr, null = null, delta = 0, side = side, level = conf.level)) ) contr_est_res <- suppressMessages(dplyr::full_join(contr_ci, contr_pval)) + if (all(contr_est_res$contrast == paste(paste0(var, rev(ems@levels[[1]])), collapse = " - "))) { + contr_est_res$contrast <- paste(rev(ems@levels[[1]]), collapse = " - ") + } structure( list( diff --git a/data-raw/high1.sas7bdat b/data-raw/high1.sas7bdat new file mode 100644 index 0000000000000000000000000000000000000000..c8195f1eec2a65323d9f285fd87a95cf94d1043b GIT binary patch literal 37888 zcmeI5Z-`~*S-{^-(sUYEJHbKr!%%O>aU9lly>n;(OyZh38+V&T@@Lr@Wx?2PY!XY2 zrPQE7LWxo|AA*z`qlVC?5~G#1Rx2Wc-D@paP!#hipp<+F7K$I%QYuZ-jOV=1^Ly@` z=ef_GiU|3z2X^kAJHPw9&+j?!dHQvk`UAb!CkI;Owo(?aKLE0GdS~>WyY4=F=UsQ)Ir={wXHM^)?%w{| zM{m0AAOGX!(`_S9j=tJGw#U=|I2NV}hdJL%$$`t1gex|9JfsY{4Q zU547FE{AAWJpK}ov@YWJCAh=RcZGhnR|^<8e69Z_9KNdq@$enu@HI~Iei@Hr&cph% z^e_4JnVcV93Iy16AlmS_mcPebDICE^H`>zCLA8dZI|u{@$gtA-e^9D$DsiZ z59{|5Z;XdOAJ$LL)^-Dj$6@+&5)TjKni}s+)^6#K2Z5vA1vsf+;Ar>Cc5i$M9Q9kK z-`Dg?;HaN*;&C?~KQ7I6Uk+mv#b&hj9|GEHz(!{WJgd(l6d2?<;HiSW36`dh_)?<=St)!{e>@o{Qys zHTV6wb$;ES*|FO#cgwl@wW(|6?q~bov(SFuE^m|L$m~6Pdwc6;wW6bzzOlT$je4WL zZ*TA0d#~?x-@UQ-rq%b2_C4p6=pMSZ$_)p~sC%f-uPdwV= z?r1~rZOPO2>uQ@#cbt+~<$`|ysAl-M*5wJyxTC+_#(1)OqDQ-I?H%2oerNaWxpSv? z?>c+$Zqdily+3u&?Pt%IvU`5F{d4y8?mg{KM?Z1jnRW#1e7Zm9?z`{qyYBtz`gr!t zsC{~NXZNlsE_OcKZ|m{eoY%fJ=Q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oCLA96_t?hj8{*-if6qPT@Gws565`>(??q_4U&h0a zf9zi~4v$jgbFGZSgZoO#y-d6QzKyG2;AofqW)_cjZGM;Y5#mulTjwPl^>guF!Q+I~ z-S%@f-b=i|;bG@P-XAzTxNoEPcVDGlf8SxD(eokk0!O>tkICZEuG`Orc+}6gVG9CmtJ;uhozLe?rf1;P5!w_x%R({NJ;%c}Cg^9Py0XF5MA0>SEk+!|E1uJ_nbEyujI$e)bHBJ)dh{t)eby&i2-rV^O@n++0Z(kp{nQxDi*5`ixA6*!}W&i*H literal 0 HcmV?d00001 diff --git a/data-raw/low1.sas7bdat b/data-raw/low1.sas7bdat new file mode 100644 index 0000000000000000000000000000000000000000..7ff50e010709b7c8ff6c3e8021979eb306ecb29e GIT binary patch literal 50176 zcmeI5YpkVLS;yB*hcZBcsgB7+YdDmlPHL^^oKDLWO1nqfYPHZwJ78lrw}0~B`G5172lkg|{l(Th553^P`4?VT zwlCbXcY9yQ&e=1RZ||wd)ukLbXAj6N$8XuV{)QW`yYZ$U+4$c)u04M8`1JlyeeO-i zHvaYRkMrEF^Wfh;(x0c`4wQ0UE13Vd^3u)i&Fxog-+JQ5PTYJ`_{BH)a=PYM-oEEG z{FmSUu@`;%m!`5IwhTS}^V2QxP1*t<)%cyld&cy~-s9zY^=YI2@wjI6!TOrH^-uN1 zrpoWCukV}QQ-3~OUtg=&pLYDlI{f}&IZf(zNP%U|E{!e9`+3j{Mg4)_VSc_``w!VU^W) zSpA3eyNd!}IUdGutma=`yq>=s-z{yzx9qZhd=KrC$2Ydm>C=Q$EFOH1 z4D~mkSt=Z>xV7Jic2~JiFlWJsSAu)@YtNM`ZEfdqv<&`TA-3 zK7{Xf@@@UAc=nd>z}I+u+j#E$dlq?oH$psn%aiaQAf78yJhA=vmRE5CFrIiW4E1l) zI;9v-JZ=0d{@csBi}BF@o1y-9&g;L?T545X1PW{`f`KtJ~{_5jr z@BGWU@n;_2h5gHTeA9lqSUc@BF?|+&2{lBuBUtOZ-p?~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mLNV{^Qg6Kj#zLKb?p9{NM6<+CTAX{$f1sKhAgXr}KZ>r|s8af9Wl>_C?J9{|9-G B>2d%7 literal 0 HcmV?d00001 diff --git a/data-raw/low_high.R b/data-raw/low_high.R new file mode 100644 index 0000000..93bbb11 --- /dev/null +++ b/data-raw/low_high.R @@ -0,0 +1,5 @@ +low1 <- haven::read_sas("./data-raw/low1.sas7bdat") +usethis::use_data(low1, overwrite = TRUE) + +high1 <- haven::read_sas("./data-raw/high1.sas7bdat") +usethis::use_data(high1, overwrite = TRUE) diff --git a/data/high1.rda b/data/high1.rda new file mode 100644 index 0000000000000000000000000000000000000000..d14b0f8bf024a32bd14d34250bb874247f6de34e GIT binary patch literal 2371 zcmb7G{Xf%*1K+S2A)628;jYD|O5>GFsxhF}OBJ@=t!%=>&0$1W)fw_ZypKrBSgfhu2 z31#0;oBsvBrvIM`IGU78tY$XqEgMy!V@i-vDEzv?M1qoBi622Ag9&9A zeucxp5xH276i2C9%b~>0bITGilUWWU)q4u7uRXyKsxmlPtN(j3EL!_%&$~f$yWz93M!+zn3+{F<@31@Wu+mFM_klzEPT9= zb2|SxX~v1eT=MaA1AfwMxe%>Ng{I8mOxlX8(@*!deinA z!;^lAo9PUdCYEuclIYAp#&P+{GENgg`*Y@^=09P>!N}b76Q)G@9;~Fg5suRMr(8_S z*o>>#UPaEXID1XKZIf=%3;DenBxa$L33}~|SG~Qq{%%gAv^Yw%ZvWx3GsKA+w86?GZSuNl zu!E8<0LP^dO)kzX%&4FUqfWav+?Mxpec%(4o!iVn2zcU?lS~ZSn`-#@?vvF>Vr{ud zqhUU6dl%e!7-zZ4$+R$BS&{te2bixDPL41%#Xz$sy?x-JAB?-xUp!povBnqB&xU>;#X{)nbLs7+?A@d?eMyA^XYQF@>jV!Ihr!bleHq6OM*J=LImn zi#p91%^k{39ISL)6^gyE0+K%^EYcl7UFE~)cexBjG=*1`lLE6+=Hc(ht(x1@iqJ@( z%u$}w)6nWynisa8Sdy68p^3mt>bbkALoSWG_O(sm>ZZLP2l%I*A1#?G8$imp6=O?$ zOXT|?webLAYzM*jY6sprl~~DBZeTA_Vw+ZGK_2<+4aEbF+=!`nd)0{^?GkdRjyuG{{kzz6mVdWLc{Iz!U%4H|(8&~H$XSH2d_;eLVnGrak zoH)F%iTKv$crPgO7mtQ8x~On-5lZFUrOl&&`pv?o8%XaGB_kBja$tFrlU=y2;GoJ!}=06Hz44hQNX zW=3NLjg8}D%o(h5;5yNhLChnmw?vW9o^&Iz9LuFcfHN!T*IBx8TL>3U=znSPkV-T_ ze83borGV#vHUPTv3VU{nc`_?#JF+3*+cf_N$wX$U|3H zO^>{|Az)D{P z!I=DhvyA8pU%bG8kd!_a?ToO)ANC{xT8^%k4%jW@VJfWDX3%@}Ur9V4$LGwleDF;d z7yE8bUzF9hTqoEW!Hj16AB+FC;O1VmcSnliI0`6ZvoT*c7thQKwaUUx_5pnHyo1r}tQjuz$g z2#;9i*-mZj?oB%&Pv{Dj-iqm-UTBG~x&QZBbze{pZ!*E>-pvPFk9TU``-~4*#!(Ay zJ?nT}#n5m6aM_GKy>Xpx@f*~O=sVd;(*R>D(0c0W*l<8y%f92Ldjel;p>}u2@eVP$7JYaz#-6I~!`Y`<6*-wC z>rmfru%+dHZ1MIpPv-*qI_CoZw_Usp7ao0bThMhO!iVyZa2@~#k$r_Kq|%0zvho+C z=@Ph_+4}-o{czjzl*Zw}2v4>938>y`)HfNrP Q#4I}>q6M>L|D2}(0*%x7od5s; literal 0 HcmV?d00001 diff --git a/data/low1.rda b/data/low1.rda new file mode 100644 index 0000000000000000000000000000000000000000..412c5a61f07561a3c4717b7b1c44736816606a8e GIT binary patch literal 2231 zcmZ9JSya-A0>=Lkl8|-)(G;^m0|Z=B!_sOB6dg8k!v%D_NMu4*R@O{jYfurztXOPO zO98=@7SpsWt&Gyrv_Z5*+uX9KtZAP$Zx8orelOqo&iT&o<%R6ghW1tH}Dil z_MZF3*Yqz>zr~lQ$#YL1_e4cK{VD$WoOpUC&modOJ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RVvDmSj{h40P* z_6au5XeIg3jW3F933O$|d4{Y~#aY$C?Fod*jY?EW3QXQ{I4XpV2k1_VUSyf_EA*Xq2v>+SxvYJYX$5jI|T{^_u literal 0 HcmV?d00001 diff --git a/man/missing_data.Rd b/man/missing_data.Rd new file mode 100644 index 0000000..01f98d4 --- /dev/null +++ b/man/missing_data.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{low1} +\alias{low1} +\alias{high1} +\title{Example Datasets with low and high dropout} +\format{ +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 961 rows and 6 columns. + +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 831 rows and 6 columns. +} +\usage{ +low1 + +high1 +} +\description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} + +These two datasets are from Mallinckrodt et al. +(https://journals.sagepub.com/doi/pdf/10.1177/2168479013501310) which is available +via (https://www.lshtm.ac.uk/research/centres-projects-groups/missing-data#dia-missing-data). +The original data were from 2 nearly identically designed antidepressant clinical +trials that were originally reported by Goldstein et al and Detke et al. +Assessments on the Hamilton 17-item rating scale for depression (HAMD17)19 were +taken at baseline and weeks 1, 2, 4, 6, and 8 in each trial. +} +\keyword{datasets} diff --git a/tests/testthat/test-summarize-lsmeans.R b/tests/testthat/test-summarize-lsmeans.R index 92ed704..ddbabcb 100644 --- a/tests/testthat/test-summarize-lsmeans.R +++ b/tests/testthat/test-summarize-lsmeans.R @@ -108,3 +108,15 @@ test_that("s_get_lsmeans works as expected for ancova", { tolerance = 0.0001 ) }) + +test_that("s_get_lsmeans works as expected when the grouping variable is numeric", { + data("low1") + fit <- low1 %>% + dplyr::filter(week == 8 & !is.na(change)) %>% + lm(formula = change ~ basval + trt) + res <- s_get_lsmeans(fit, "trt") + + expect_identical(dim(res$lsm_est), c(2L, 8L)) + expect_identical(dim(res$lsm_contr), c(1L, 8L)) + expect_identical(res$lsm_contr$contrast, "2 - 1") +})