You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/codebook.R
+68-16Lines changed: 68 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,16 @@
2
2
3
3
#' Generate rmarkdown codebook
4
4
#'
5
-
#' If you pass the object resulting from a call to formr_results to this function, it will generate a markdown codebook for this object.
5
+
#' Pass a data frame to this function to make a codebook for that dataset.
6
+
#' If the dataset has metadata (attributes) set on its variables, these will be
7
+
#' used to make the codebook more informative. Examples are item, value, and
8
+
#' missing labels.
9
+
#' Data frames imported via [haven::read_dta], [haven::read_sav], or from
10
+
#' [formr.org](https://formr.org) will have these attributes in the right format.
11
+
#' By calling this function inside a knitr code chunk, the
12
+
#' codebook will become part of the document you are generating.
6
13
#'
7
-
#' @param results a formr results table with attributes set on items and scales
14
+
#' @param results a data frame, ideally with attributes set on variables
8
15
#' @param reliabilities a named list with one entry per scale and one or several printable reliability computations for this scale. if NULL, computed on-the-fly using compute_reliabilities
9
16
#' @param survey_repetition defaults to "auto" which is to try to determine the level of repetition from the "session" and "created" variables. Other values are: single, repeated_once, repeated_many
10
17
#' @param missingness_report whether to print a missingness report. Turn off if this gets too complicated and you need a custom solution (e.g. in case of random missings).
@@ -14,7 +21,10 @@
14
21
#'
15
22
#' @export
16
23
#' @examples
17
-
#' # see vignette
24
+
#' # will generate figures in a figure/ subdirectory
Easily automate the following tasks to describe data frames:
21
+
computing reliabilities (internal consistencies, retest, multilevel) for psychological scales,
22
+
summarise the distributions of scales and items graphically and using descriptive statistics,
23
+
combine this information with metadata (such as item labels and labelled values) that is derived from R attributes.
24
+
To do so, the package relies on 'rmarkdown' partials, so you can generate HTML, PDF, and Word documents. Codebooks
25
+
are also available as tables (CSV, Excel, etc.).
26
+
18
27
## Generate markdown codebooks from the attributes of the variables in your data frame
19
28
20
29
RStudio and a few of the tidyverse package already usefully display the information contained in the attributes of the variables in your data frame. The [haven](https://github.com/hadley/haven) package also manages to grab variable documentation from SPSS or Stata files.
21
30
22
31
The codebook package takes those attributes and the data and tries to produce a good-looking codebook, i.e. a place to get an overview of the variables in a dataset. The codebook processes single items, but also "scales", i.e. psychological questionnaires that are aggregated to extract a construct. For scales, the appropriate reliability coefficients (internal consistencies for single measurements, retest reliabilities for repeated measurements, multilevel reliability for multilevel data) are computed.
23
32
For items and scales, the distributions are summarised graphically and numerically.
24
33
25
-
This package integrates tightly with formr ([formr.org](https://formr.org)), an online survey framework and especially the data frames produced and marked up by the [formr R package](https://github.com/rubenarslan/formr), but is completely independent of it.
26
-
27
-
To do this, this package uses rmarkdown _partials_, that can be integrated in a larger rmarkdown document and then translated to HTML or PDF format.
34
+
This package integrates tightly with formr ([formr.org](https://formr.org)), an online survey framework and especially the data frames produced and marked up by the [formr R package](https://github.com/rubenarslan/formr). However, codebook is completely independent of it.
28
35
29
36
## Documentation
30
-
Confer the help or: https://rubenarslan.github.io/codebook
37
+
Confer the help or: https://rubenarslan.github.io/codebook.
38
+
See the [vignette](https://rubenarslan.github.io/codebook/articles/codebook.html) for a quick example of an HTML document generated using `codebook`.
Easily automate the following tasks to describe data frames: computing reliabilities (internal consistencies, retest, multilevel) for psychological scales, summarise the distributions of scales and items graphically and using descriptive statistics, combine this information with metadata (such as item labels and labelled values) that is derived from R attributes. To do so, the package relies on 'rmarkdown' partials, so you can generate HTML, PDF, and Word documents. Codebooks are also available as tables (CSV, Excel, etc.).
12
+
8
13
Generate markdown codebooks from the attributes of the variables in your data frame
RStudio and a few of the tidyverse package already usefully display the information contained in the attributes of the variables in your data frame. The [haven](https://github.com/hadley/haven) package also manages to grab variable documentation from SPSS or Stata files.
12
17
13
18
The codebook package takes those attributes and the data and tries to produce a good-looking codebook, i.e. a place to get an overview of the variables in a dataset. The codebook processes single items, but also "scales", i.e. psychological questionnaires that are aggregated to extract a construct. For scales, the appropriate reliability coefficients (internal consistencies for single measurements, retest reliabilities for repeated measurements, multilevel reliability for multilevel data) are computed. For items and scales, the distributions are summarised graphically and numerically.
14
19
15
-
This package integrates tightly with formr ([formr.org](https://formr.org)), an online survey framework and especially the data frames produced and marked up by the [formr R package](https://github.com/rubenarslan/formr), but is completely independent of it.
16
-
17
-
To do this, this package uses rmarkdown *partials*, that can be integrated in a larger rmarkdown document and then translated to HTML or PDF format.
20
+
This package integrates tightly with formr ([formr.org](https://formr.org)), an online survey framework and especially the data frames produced and marked up by the [formr R package](https://github.com/rubenarslan/formr). However, codebook is completely independent of it.
18
21
19
22
Documentation
20
23
-------------
21
24
22
-
Confer the help or: <https://rubenarslan.github.io/codebook>
25
+
Confer the help or: <https://rubenarslan.github.io/codebook>. See the [vignette](https://rubenarslan.github.io/codebook/articles/codebook.html) for a quick example of an HTML document generated using `codebook`.
0 commit comments