Description Usage Arguments Value Examples
View source: R/explore_table.R
Summary statistics and plots of the table columns.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
ftable |
data.frame or data.table |
ftarget |
string: columname of ftable including the target. Optional. Use ftarget = NA to explore the table without target column. |
fassign_classes |
TRUE or FALSE. TRUE assigns a new class to each column. |
fadd_tables |
TRUE or FALSE. Add or not add a table. |
ft_format |
TRUE or FALSE. Format or not format the table values. |
ftmax_levels |
Integer. Maximum number of table rows. Set NA to ignore constraint. |
fadd_plots |
TRUE or FALSE. Add or not add a plot. |
fprm_na |
TRUE or FALSE. Remove or not remove NAs before plotting. |
fptext_labels |
TRUE or FALSE. Add or not add text labels to bar plots. |
fpmax_numlevels |
Integer. If number of numerics is smaller, then plot bar plot instead of line plot. |
fpmax_faclevels |
Integer. Maximum number of bars to be plotted for each segment. |
list with several elements: summary: the summary statistics. plot$name$count: ggplots of absolute frequencies of each column. plot$name$rel: ggplots of relative frequencies of each column.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | ## Not run:
---
title: "My document"
date: "`r Sys.Date()`"
author: mz
output:
rmdformats::downcute:
self_contained: true
thumbnails: true
lightbox: true
gallery: false
highlight: tango
---
<style>
.page-content img.image-thumb {
width: 400px;
border: 1px solid #CCC;
padding: 0;
}
li {
height: 30px;
}
summary:focus {
outline: none;
}
summary:hover {
text-decoration: underline;
}
</style>
```{r, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
knitr::opts_chunk$set(warning = FALSE)
knitr::opts_chunk$set(message = FALSE)
```
```{r}
library(mzfun)
library(magrittr)
library(data.table)
library(ggplot2)
library(flextable)
library(knitr)
library(DT)
library(htmltools)
```
```{r}
et1 = explore_table(copy(d3[1:1000]), ftarget ='Anrede', fassign_classes = TRUE,
fadd_tables = TRUE, fadd_plots = TRUE, fpmax_numlevels = 20, fprm_na = FALSE,
fpmax_faclevels = 50, fptext_labels = TRUE, ft_format = FALSE)
```
```{r, results='asis'}
dnames = et1$plot %>% names
i = dnames[1]
cat('# Summary', '\n\n')
datatable(et1$summary)
out = NULL
cat('\n\r')
for (i in dnames){
cat('#', i, '\n')
et1$plot[[i]]$count %>% print
et1$plot[[i]]$rel %>% print
cat('\n\r')
cat('<details>')
cat('\n\r')
cat('<summary>Tabelle</summary>')
cat('\n\r')
dtable = et1$table[[i]] %>% flextable() %>%
align(align = 'right', part = 'all') %>%
align(j = 1, align = 'left', part = 'all')
cat(knit_print(dtable))
cat('\n\r')
cat('</details>')
cat('\n\r')
cat('\n\r')
}
```
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.