Skip to content

Commit 63b7690

Browse files
committed
Added examples to chapmanRobson() for multiple groups
1 parent 7ede23f commit 63b7690

File tree

4 files changed

+66
-1
lines changed

4 files changed

+66
-1
lines changed

R/catchCurve.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
#' as.data.frame() # removes tibble and grouping structure
137137
#' res
138138
#' }
139-
139+
#'
140140
#' @rdname catchCurve
141141
#' @export
142142
catchCurve <- function (x,...) {

R/chapmanRobson.R

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,38 @@
9595
#' summary(cr3)
9696
#' plot(cr3)
9797
#'
98+
#' ## Demonstration of computation for multiple groups
99+
#' ## only ages on the descending limb for each group are in the data.frame
100+
#' # Get example data
101+
#' data(FHCatfish,package="FSAdata")
102+
#' FHCatfish
103+
#'
104+
#' # Note use of incl.est=TRUE and as.df=TRUE
105+
#' if (require(dplyr)) {
106+
#' res <- FHCatfish %>%
107+
#' dplyr::group_by(river) %>%
108+
#' dplyr::group_modify(~confint(chapmanRobson(abundance~age,data=.x),
109+
#' incl.est=TRUE,as.df=TRUE)) %>%
110+
#' as.data.frame() # removes tibble and grouping structure
111+
#' res
112+
#' }
113+
#'
114+
#' ## Demonstration of computation for multiple groups
115+
#' ## ages not on descending limb are in the data.frame, but use same
116+
#' ## ages.use= for each group
117+
#' # Get example data
118+
#' data(WalleyeKS,package="FSAdata")
119+
#'
120+
#' # Note use of incl.est=TRUE and as.df=TRUE
121+
#' if (require(dplyr)) {
122+
#' res <- WalleyeKS %>%
123+
#' dplyr::group_by(reservoir) %>%
124+
#' dplyr::group_modify(~confint(chapmanRobson(catch~age,data=.x,ages2use=2:10),
125+
#' incl.est=TRUE,as.df=TRUE)) %>%
126+
#' as.data.frame() # removes tibble and grouping structure
127+
#' res
128+
#' }
129+
#'
98130
#' @rdname chapmanRobson
99131
#' @export
100132
chapmanRobson <- function (x,...) {

man/catchCurve.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/chapmanRobson.Rd

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)