Skip to content

Commit 1373a10

Browse files
committed
based on formr pre haven semantics
1 parent 8afc30a commit 1373a10

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
^.*\.Rproj$
22
^\.Rproj\.user$
33
^docs
4+
.zenodo.json

.zenodo.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"title": "Cook codebooks from survey metadata encoded in attributes in R",
3+
"upload_type": "software",
4+
"creators": [
5+
{
6+
"affiliation": "Center for Adaptive Rationality, Max Planck Institute for Human Development",
7+
"name": "Ruben C. Arslan"
8+
}
9+
],
10+
"access_right": "open"
11+
}

R/codebook.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ codebook = function(results, indent = '#') {
3838
#' @param scale a scale with attributes set
3939
#' @param results a formr results table with attributes set on items and scales
4040
#' @param indent add # to this to make the headings in the components lower-level. defaults to beginning at h2
41+
#' @param survey_repetition defaults to single (other values: repeated_once, repeated_many). controls whether internal consistency, retest reliability or multilevel reliability is computed
4142
#'
4243
#' @export
43-
codebook_component_scale = function(scale, results, indent = '###') {
44+
codebook_component_scale = function(scale, results, indent = '###', survey_repetition = "single") {
4445
stopifnot( exists("item", attributes(scale)))
4546
stopifnot( exists("scale", attributes(scale)))
4647
stopifnot( exists("scale_item_names", attributes(scale)))

inst/_codebook.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ ggplot2::qplot(duration$duration, binwidth = 0.5) + ggplot2::scale_x_continuous(
7878

7979
```{r scales,results='asis'}
8080
vars = names(results)
81-
knit_scales = listenv::listenv()
81+
knit_scales = new.env()
8282
for (i in seq_along(vars)) {
8383
var = vars[i]
8484
scale = results[[ var ]]
8585
scale_info = attributes(scale)
8686
if ( !is.null(scale_info)) {
8787
if (exists("scale", scale_info)) {
88-
knit_scales[[ var ]] = future::value(future::future( codebook_component_scale( scale, results, indent ) ))
88+
future::`%<-%`(knit_scales[[ var ]], codebook_component_scale( scale, dplyr::select(results, session, dplyr::starts_with(scale_info$scale)), indent, survey_repetition) )
8989
}
9090
}
9191
}

man/codebook_component_scale.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)