Skip to content

Commit

Permalink
Merge devel into main
Browse files Browse the repository at this point in the history
Merge branch 'devel'

# Conflicts:
#	vignettes/introduction.Rmd
  • Loading branch information
strohne committed May 30, 2024
2 parents 94d470d + a111ed6 commit 43ee82e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
2 changes: 2 additions & 0 deletions R/report.R
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ html_report <- function(...) {
cssfile <- paste0(system.file("extdata", package = "volker"),"/styles.css")
rmarkdown::html_document(
css = cssfile,
#df_print = "kable",
...
)
}

5 changes: 2 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ plot_counts(data, starts_with("cg_adoption_social"))
tab_metrics(data, starts_with("cg_adoption_social"))
```

See further [examples in the introduction
vignette](articles/introduction.html).
See further examples in `vignette("introduction", package="volker")`.

Don't miss the template feature: Within RStudio, create a new Markdown
document, select `From template`, choose and finally knit the **volkeR
Expand Down Expand Up @@ -168,7 +167,7 @@ Examples:
- Multiple categorical variables: `tab_counts(data, starts_with("cg_adoption"))`

**Hint**: replace `tab_` by `plot_` to reproduce the examples above.
You'll find different table, plot and report types in [the introduction vignette](vignettes/introduction.Rmd).
You'll find different table, plot and report types in the `vignette("introduction", package="volker")`.
For further options to customize the results, see the builtin function help (F1 key).

After deciding whether to plot or tabulate, and whether to handle metric or counted data,
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ High-level functions for tabulating, charting and reporting survey data.
# Create your first table, summarising the item battery
tab_metrics(data, starts_with("cg_adoption_social"))

See further [examples in the introduction
vignette](articles/introduction.html).
See further examples in `vignette("introduction", package="volker")`.

Don’t miss the template feature: Within RStudio, create a new Markdown
document, select `From template`, choose and finally knit the **volkeR
Expand Down Expand Up @@ -157,9 +156,9 @@ Examples:
`tab_counts(data, starts_with("cg_adoption"))`

**Hint**: replace `tab_` by `plot_` to reproduce the examples above.
You’ll find different table, plot and report types in [the introduction
vignette](vignettes/introduction.Rmd). For further options to customize
the results, see the builtin function help (F1 key).
You’ll find different table, plot and report types in the
`vignette("introduction", package="volker")`. For further options to
customize the results, see the builtin function help (F1 key).

After deciding whether to plot or tabulate, and whether to handle metric
or counted data, the column selections determine which of the following
Expand Down
24 changes: 14 additions & 10 deletions vignettes/introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ editor_options:
knitr::opts_chunk$set(
comment = "",
echo = TRUE,
message = FALSE,
knitr.table.format = "html"
message = FALSE
)
```
Expand Down Expand Up @@ -45,10 +44,11 @@ Decide whether your data is categorical or metric
and choose the appropriate function:

- `tab_counts()` shows frequency tables.
- `tab_metrics()` creates tables with distribution parameters.
- `plot_counts()` generated simple and stacked bar charts.
- `effect_counts()` calculates test statistics for categorical data.
<br>
- `tab_metrics()` creates tables with distribution parameters.
- `plot_metrics()` visualised distributions in density plots, box plots or scatter plots.
- `effect_counts()` calculates test statistics for categorical data.
- `effect_metrics()` calculates test statistics for metric data.

The column selection determines whether to analyse single variables, item lists
Expand Down Expand Up @@ -259,14 +259,18 @@ ds %>%
```

Alternatively, save the result of `codebook(ds)` to an Excel file,
change the labels manually and then call `labs_apply()` with your new codebook.
change the labels manually in a copy of the Excel file,
and finally call `labs_apply()` with your revised codebook.

```{r, eval = FALSE}
library(readxl)
library(writexl)
codes <- codebook(ds)
write_xlsx(codes,"codebook.xlsx")
codes <- read_xlsx("codebook-new.xlsx")
codes <- read_xlsx("codebook_revised.xlsx")
ds <- labs_apply(codebook)
```
Expand Down Expand Up @@ -314,13 +318,13 @@ code dry - don't repeat yourself - and wraps often used snippets into a simple i

Basically, all table values are calculated two tidyverse functions:

- count() is used to produce counts
- skim() is used to produce metrics
- `count()` is used to produce counts
- `skim()` is used to produce metrics

To shape the data frames, two essential functions come into play:

- group_by() is used to calculate grouped outputs
- pivot_longer() brings multiple items into a format where the item name becomes a grouping variable.
- `group_by()` is used to calculate grouped outputs
- `pivot_longer()` brings multiple items into a format where the item name becomes a grouping variable.

Plots are generated by `ggplot()`.

Expand Down

0 comments on commit 43ee82e

Please sign in to comment.