Skip to content

Commit

Permalink
20230525 - REDCap progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
isaactpetersen committed May 26, 2023
1 parent 8dea44c commit 2666494
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 40 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: petersenlab
Type: Package
Title: Package of R Functions for the Petersen Lab
Version: 0.1.2-9017
Version: 0.1.2-9018
Authors@R: person("Isaac T.", "Petersen",
email = "isaac-t-petersen@uiowa.edu",
role = c("aut", "cre"),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export(plot2WayInteraction)
export(pom)
export(ppPlot)
export(read.aes)
export(redcapProgressBar)
export(reliabilityIRT)
export(reliabilityOfDifferenceScore)
export(repeatability)
Expand Down
45 changes: 45 additions & 0 deletions R/redcapProgressBar.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#' @title
#' Progress Bar for REDCap.
#'
#' @description
#' Function that identifies the values for a progress bar in REDCap.
#'
#' @details
#' A progress bar in REDCap can be created using the following code:
#' \preformatted{
#' Progress:
#' <div style="width:100\%;border:0;margin:0;padding:0;background-color:
#' #A9BAD1;text-align:center;"><div style="width:2\%;border: 0;margin:0;
#' padding:0;background-color:#8491A2"><span style="color:#8491A2">.
#' </span></div></div>
#' }
#' where \code{width:2\%} specifies the progress (out of 100\%).
#'
#' @param numSurveys the number of surveys to establish progress.
#' @param beginning the first value to use in the sequence.
#' @param end the last value to use in the sequence.
#'
#' @return sequence of numbers for the progress bar in REDCap.
#'
#' @importFrom stats pchisq
#'
#' @export
#'
#' @examples
#' redcapProgressBar(numSurveys = 6)
#' redcapProgressBar(6)
#' redcapProgressBar(4)
#' redcapProgressBar(numSurveys = 7, beginning = 1, end = 99)

redcapProgressBar <- function(numSurveys, beginning = 2, end = 99){
progressSequence <- seq(
from = beginning,
to = end,
length.out = numSurveys)

return(progressSequence)
}




4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ remotes::install_github("DevPsyLab/petersenlab")

To obtain the citation for the `petersenlab` package, run `citation("petersenlab")`; the citation is:

Petersen, I. T. (2023). *petersenlab: Package of R functions for the Petersen Lab*. R package version 0.1.2-9017. https://github.com/DevPsyLab/petersenlab, https://doi.org/10.5281/zenodo.7602890
Petersen, I. T. (2023). *petersenlab: Package of R functions for the Petersen Lab*. R package version 0.1.2-9018. https://github.com/DevPsyLab/petersenlab, https://doi.org/10.5281/zenodo.7602890

A `BibTeX` entry for `LaTeX` users is:
```
Expand All @@ -23,7 +23,7 @@ A `BibTeX` entry for `LaTeX` users is:
title = {{petersenlab}: Package of {R} functions for the {Petersen Lab}},
url = {https://github.com/DevPsyLab/petersenlab},
doi = {10.5281/zenodo.7602890},
version = {0.1.2-9017},
version = {0.1.2-9018},
date = {2022-03-23}
}
```
Expand Down
38 changes: 38 additions & 0 deletions man/redcapProgressBar.Rd

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

Loading

0 comments on commit 2666494

Please sign in to comment.