Skip to content
Open

Cran #169

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
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
^pkgdown$
^vignettes/articles$
^DO_NOT_COMMIT*
^\.#.*$
^demon*
^#.*#$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ docs
tools/lib
tools/*.html
\#\*R:scripts\*\#
*.org
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.3.1
Date: 2025-08-18 20:38:57 UTC
SHA: 03f0cc66b17667d39907be289ad0930cfb6ea1f6
Version: 1.4.1
Date: 2026-06-15 15:59:18 UTC
SHA: dbea2a109738231b67030e826fee70e27ca53408
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: pcvr
Type: Package
Title: Plant Phenotyping and Bayesian Statistics
Version: 1.4.0
Version: 1.4.1
Authors@R:
c(person("Josh", "Sumner", email = "jsumner@danforthcenter.org",
role = c("aut", "cre"), comment = c(ORCID = "0000-0002-3399-9063")),
Expand All @@ -21,8 +21,7 @@ License: GPL-2
Encoding: UTF-8
LazyData: true
LazyDataCompression: xz
Additional_repositories: https://mc-stan.org/r-packages/
RoxygenNote: 7.3.2
Additional_repositories: https://stan-dev.r-universe.dev
Imports:
FactoMineR,
rlang,
Expand Down Expand Up @@ -64,3 +63,5 @@ VignetteBuilder: knitr
Config/testthat/edition: 3
URL: https://github.com/danforthcenter/pcvr, https://plantcv.org/, https://danforthcenter.github.io/pcvr/
BugReports: https://github.com/danforthcenter/pcvr/issues
Config/roxygen2/version: 8.0.0
RoxygenNote: 7.3.2
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# pcvr 1.4.1

Minor edits in tutorials/articles/examples for CRAN and accessibility.

# pcvr 1.4.0

Added `stat_growthss` to make ggplot layers of models from `growthSS`.
Expand Down
19 changes: 0 additions & 19 deletions R/barg.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,6 @@
#' @seealso \link{plotPrior} for visual prior predictive checks.
#' @examples
#' \donttest{
#' simdf <- growthSim("logistic",
#' n = 20, t = 25,
#' params = list("A" = c(200, 160), "B" = c(13, 11), "C" = c(3, 3.5))
#' )
#' ss <- growthSS(
#' model = "logistic", form = y ~ time | id / group, sigma = "logistic",
#' df = simdf, start = list(
#' "A" = 130, "B" = 12, "C" = 3,
#' "sigmaA" = 20, "sigmaB" = 10, "sigmaC" = 2
#' ), type = "brms"
#' )
#' fit_test <- fitGrowth(ss,
#' iter = 600, cores = 1, chains = 1, backend = "cmdstanr",
#' sample_prior = "only" # only sampling from prior for speed
#' )
#' b <- barg(fit_test, ss)
#' fit_2 <- fit_test
#' fit_list <- list(fit_test, fit_2)
#' x <- barg(fit_list, list(ss, ss))
#'
#' x <- conjugate(
#' s1 = rnorm(10, 10, 1), s2 = rnorm(10, 13, 1.5), method = "t",
Expand Down
12 changes: 1 addition & 11 deletions R/brmPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,7 @@
#' @importFrom stats as.formula
#' @examples
#' \donttest{
#' simdf <- growthSim(
#' "logistic",
#' n = 20, t = 25,
#' params = list("A" = c(200, 160), "B" = c(13, 11), "C" = c(3, 3.5))
#' )
#' ss <- growthSS(
#' model = "logistic", form = y ~ time | id / group, sigma = "spline",
#' list("A" = 130, "B" = 10, "C" = 3),
#' df = simdf, type = "brms"
#' )
#' fit <- fitGrowth(ss, backend = "cmdstanr", iter = 500, chains = 1, cores = 1)
#' data(fit)
#' growthPlot(fit = fit, form = y ~ time | group, groups = "a", df = ss$df)
#' }
#'
Expand Down
15 changes: 3 additions & 12 deletions R/brmSurvPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,12 @@
#' n = 20, t = 50,
#' params = list("A" = c(1, 1), "B" = c(0.15, 0.1))
#' )
#' ss1 <- growthSS(
#' ss <- growthSS(
#' model = "survival weibull", form = y > 100 ~ time | id / group,
#' df = df, start = c(0, 5)
#' )
#' fit1 <- fitGrowth(ss1, iter = 600, cores = 2, chains = 2, backend = "cmdstanr")
#' brmSurvPlot(fit1, form = ss1$pcvrForm, df = ss1$df)
#'
#' # note that using the cumulative hazard to calculate survival is likely to underestimate
#' # survival in these plots if events do not start immediately.
#' ss2 <- growthSS(
#' model = "survival binomial", form = y > 100 ~ time | id / group,
#' df = df, start = c(-4, 3)
#' )
#' fit2 <- fitGrowth(ss2, iter = 600, cores = 2, chains = 2, backend = "cmdstanr")
#' brmSurvPlot(fit2, form = ss2$pcvrForm, df = ss2$df)
#' data(surv)
#' brmSurvPlot(surv, form = ss$pcvrForm, df = ss$df)
#' }
#'
#' @return Returns a ggplot showing a brms model's credible
Expand Down
13 changes: 1 addition & 12 deletions R/brmViolin.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,7 @@
#' @examples
#' \donttest{
#' set.seed(123)
#' simdf <- growthSim(
#' "logistic",
#' n = 20, t = 25,
#' params = list("A" = c(200, 180, 190, 160), "B" = c(13, 11, 10, 10), "C" = c(3, 3, 3.25, 3.5))
#' )
#' ss <- growthSS(
#' model = "logistic", form = y ~ time | id / group, sigma = "int",
#' list("A" = 130, "B" = 10, "C" = 3),
#' df = simdf, type = "brms"
#' )
#'
#' fit <- fitGrowth(ss, backend = "cmdstanr", iter = 500, chains = 1, cores = 1)
#' data(fit)
#' brmViolin(fit, ss, ".../A_groupd > 1.05") # all groups used
#' brmViolin(fit, ss, "abs(1 - ((...)/(C_groupd - B_groupd))) > 0.05") # rather arbitrary
#' brmViolin(fit, ss, "abs(1 - ((...)/(C_groupa - B_groupd))) > 0.05") # totally arbitrary
Expand Down
61 changes: 6 additions & 55 deletions R/combineDraws.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,61 +24,12 @@
#' @examples
#' # note that this example will fit several models using Stan and may run slowly.
#' \donttest{
#' simdf <- growthSim("logistic",
#' n = 20, t = 25,
#' params = list(
#' "A" = c(200, 160, 220, 200, 140, 300),
#' "B" = c(13, 11, 10, 9, 16, 12),
#' "C" = c(3, 3.5, 3.2, 2.8, 3.3, 2.5)
#' )
#' )
#' ss_ab <- growthSS(
#' model = "logistic", form = y ~ time | id / group,
#' sigma = "logistic", df = simdf[simdf$group %in% c("a", "b"), ],
#' start = list(
#' "A" = 130, "B" = 12, "C" = 3,
#' "sigmaA" = 15, "sigmaB" = 10, "sigmaC" = 3
#' ), type = "brms"
#' )
#'
#' ss_cd <- growthSS(
#' model = "logistic", form = y ~ time | id / group,
#' sigma = "logistic", df = simdf[simdf$group %in% c("c", "d"), ],
#' start = list(
#' "A" = 130, "B" = 12, "C" = 3,
#' "sigmaA" = 15, "sigmaB" = 10, "sigmaC" = 3
#' ), type = "brms"
#' )
#'
#' ss_ef <- growthSS(
#' model = "logistic", form = y ~ time | id / group,
#' sigma = "logistic", df = simdf[simdf$group %in% c("e", "f"), ],
#' start = list(
#' "A" = 130, "B" = 12, "C" = 3,
#' "sigmaA" = 15, "sigmaB" = 10, "sigmaC" = 3
#' ), type = "brms"
#' )
#' ss_ef2 <- growthSS(
#' model = "gompertz", form = y ~ time | id / group,
#' sigma = "logistic", df = simdf[simdf$group %in% c("e", "f"), ],
#' start = list(
#' "A" = 130, "B" = 12, "C" = 3,
#' "sigmaA" = 15, "sigmaB" = 10, "sigmaC" = 3
#' ), type = "brms"
#' )
#'
#'
#' fit_ab <- fitGrowth(ss_ab, chains = 1, cores = 1, iter = 1000)
#' fit_ab2 <- fitGrowth(ss_ab, chains = 1, cores = 1, iter = 1200)
#' fit_cd <- fitGrowth(ss_cd, chains = 1, cores = 1, iter = 1000)
#' fit_ef <- fitGrowth(ss_ef, chains = 1, cores = 1, iter = 1000)
#' fit_ef2 <- fitGrowth(ss_ef2, chains = 1, cores = 1, iter = 1000)
#'
#' x <- combineDraws(fit_ab, fit_cd, fit_ef)
#' draws_ef <- as.data.frame(fit_ef)
#' draws_ef <- draws_ef[, grepl("^b_", colnames(draws_ef))]
#' x2 <- combineDraws(fit_ab2, fit_cd, draws_ef)
#' x3 <- combineDraws(fit_ab, fit_cd, fit_ef2)
#' data(fit)
#' fit_1 <- fit_2 <- fit
#' x <- combineDraws(fit_1, fit_2, fit)
#' draws_1 <- as.data.frame(fit_1)
#' draws_1 <- draws_1[, grepl("^b_", colnames(draws_ef))]
#' x2 <- combineDraws(fit_2, draws_1)
#' }
#'
#' @return Returns a dataframe of posterior draws.
Expand Down
26 changes: 26 additions & 0 deletions R/datasets.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#' Example model
#'
#' @description A logistic brms model of simulated growth data.
#'
#' @format A brmsfit object and a growthss object
#' @examples
#' \donttest{
#' data(fit, package = "pcvr")
#' summary(fit)
#' }
#'
"fit"


#' Example survival model
#'
#' @description An exponential survival brms model of simulated data.
#'
#' @format A brmsfit object and a growthss object
#' @examples
#' \donttest{
#' data(surv, package = "pcvr")
#' summary(surv)
#' }
#'
"surv"
10 changes: 1 addition & 9 deletions R/growthSS.R
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,7 @@
#' )
#' lapply(ss, class)
#' ss$initfun()
#' # the next step would typically be compiling/fitting the model
#' # here we use very few chains and very few iterations for speed, but more of both is better.
#' \donttest{
#' fit_test <- fitGrowth(ss,
#' iter = 500, cores = 1, chains = 1, backend = "cmdstanr",
#' control = list(adapt_delta = 0.999, max_treedepth = 20)
#' )
#' }
#'
#' # the next step would typically be compiling/fitting the model with fitGrowth
#'
#' # formulas and priors will look different if there is only one group in the data
#'
Expand Down
13 changes: 0 additions & 13 deletions R/mvSS.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@
#' model = "linear", form = label | value ~ group, df = mv_df,
#' start = list("A" = 5), type = "brms", spectral_index = "none"
#' )
#' \donttest{
#' mod1 <- fitGrowth(ss1, backend = "cmdstanr", iter = 1000, chains = 1, cores = 1)
#' growthPlot(mod1, ss1$pcvrForm, df = ss1$df)
#' library(ggplot2)
#' ggplot() + stat_brms_model(fit = mod1, ss = ss1)
#' }
#'
#' # when the model is longitudinal the same model is possible with growthSS
#'
Expand Down Expand Up @@ -97,13 +91,6 @@
#' }
#' }))
#'
#' \donttest{
#' if (rlang::is_installed("mnormt")) {
#' m2 <- fitGrowth(ss_mv1, backend = "cmdstanr", iter = 1000, chains = 1, cores = 1)
#' growthPlot(m2, ss_mv1$pcvrForm, df = ss_mv1$df)
#' }
#' }
#'
#' @export

mvSS <- function(model = "linear", form, sigma = NULL, df, start = NULL,
Expand Down
10 changes: 1 addition & 9 deletions R/stat_growthSS.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,7 @@
#'
#' @examples
#' library(ggplot2)
#' simdf <- growthSim("logistic",
#' n = 20, t = 25,
#' params = list("A" = c(200, 160), "B" = c(13, 11), "C" = c(3, 3.5))
#' )
#' ss <- growthSS(
#' model = "logistic", form = y ~ time | id / group,
#' df = simdf, start = NULL, type = "nls"
#' )
#' fit <- fitGrowth(ss)
#' data(fit)
#' ggplot() +
#' stat_growthss(fit = fit, ss = ss)
#'
Expand Down
44 changes: 19 additions & 25 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
# pcvr 1.3.1
# pcvr 1.4.1

## R CMD check results

0 errors ✔ | 0 warnings ✔ | 2 notes ✖
0 errors ✔ | 0 warnings ✔ | 1 notes ✖

❯ checking CRAN incoming feasibility ... [4s/6s] NOTE
Maintainer: ‘Josh Sumner <jsumner@danforthcenter.org>’

Possibly misspelled words in DESCRIPTION:
Kruschke (16:2, 17:2, 17:46)
Phenotyping (3:14)
phenotyping (12:44)
❯ checking for future file timestamps ... NOTE
unable to verify current time

## Notes

Resubmitting due to cran testing error probably related to either not installing
suggested packages or the change from `mc-stan.org` to `stan-dev.r--universe.dev`
for some additional packages and for development features
(ggplot2 geom support, more distributions, etc).
Previously a NOTE related to the failure specified:

```
❯ checking package dependencies ... NOTE
Package suggested but not available for checking: ‘cmdstanr’
Suggests or Enhances not in mainstream repositories:
cmdstanr
Availability using Additional_repositories specification:
cmdstanr yes https://mc-stan.org/r-packages/
❯ checking package namespace information ... OK
❯ checking package dependencies ... NOTE
Package suggested but not available for checking: ‘cmdstanr’

## Notes
cmdstanr yes https://stan-dev.r-universe.dev
```

Resubmitting due to large changes in the development version.
But the `cmdstanr` suggestion is available from the new additional repository specified in DESCRIPTION.

No notes seem critical.

Names (PlantCV, Kruschke) and words (phenotyping) in DESCRIPTION are not misspelled.
The `cmdstanr` suggestion is available from the additional repository specified in DESCRIPTION.
The R CMD check on MacOs via github actions yields a NOTE about installed package size as well.

```
* checking installed package size ... NOTE
installed size is 6.4Mb
sub-directories of 1Mb or more:
doc 4.1Mb
R 2.0Mb
```

Additionally there are some examples wrapped in `\donttest` that may take several minutes to run.

## Test environments
Expand Down
Binary file added data/fit.rda
Binary file not shown.
Binary file added data/surv.rda
Binary file not shown.
19 changes: 0 additions & 19 deletions man/barg.Rd

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

Loading
Loading