diff --git a/R/report.R b/R/report.R index 88a0fb2..98b79b7 100644 --- a/R/report.R +++ b/R/report.R @@ -444,6 +444,8 @@ html_report <- function(...) { cssfile <- paste0(system.file("extdata", package = "volker"),"/styles.css") rmarkdown::html_document( css = cssfile, + #df_print = "kable", ... ) } + diff --git a/README.Rmd b/README.Rmd index 794c829..b96641a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -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 @@ -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, diff --git a/README.md b/README.md index c56333a..7de3a60 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/vignettes/introduction.Rmd b/vignettes/introduction.Rmd index cc52e52..279df16 100644 --- a/vignettes/introduction.Rmd +++ b/vignettes/introduction.Rmd @@ -13,8 +13,7 @@ editor_options: knitr::opts_chunk$set( comment = "", echo = TRUE, - message = FALSE, - knitr.table.format = "html" + message = FALSE ) ``` @@ -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. +
+- `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 @@ -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) ``` @@ -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()`.