-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsummarytools_explore.R
85 lines (60 loc) · 1.71 KB
/
summarytools_explore.R
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
library(summarytools)
1. Overview
2. Frequency Tables: freq()
3. Cross-Tabulations: ctable()
4. Descriptive Statistics: descr()
5. Data Frame Summaries: dfSummary()
6. Grouped Statistics: stby()
7. Grouped Statistics: group_by()
8. Tidy Tables : tb()
9. Directing Output to Files
10. Package Options
11. Format Attributes
12. Fine-Tuning Looks : CSS
13. Shiny Apps
14. Graphs in R Markdown
15. Languages & Term Customization
16. Vignette Setup
freq(iris$Species, plain.ascii = FALSE, style = "rmarkdown")
freq(iris$Species, report.nas = FALSE, headings = FALSE)
freq(iris$Species,
report.nas = FALSE,
totals = FALSE,
cumul = FALSE,
headings = FALSE)
freq(tobacco)
ctable(x = tobacco$smoker,
y = tobacco$diseased,
prop = "r") # Show row proportions
descr(iris)
descr(iris,
stats = c("mean", "sd"),
transpose = TRUE,
headings = FALSE)
view(dfSummary(iris))
dfSummary(tobacco,
plain.ascii = FALSE,
style = "grid",
graph.magnif = 0.75,
valid.col = FALSE,
tmp.img.dir = "/tmp")
(iris_stats_by_species <- stby(data = iris,
INDICES = iris$Species,
FUN = descr,
stats = "common",
transpose = TRUE))
with(tobacco,
stby(data = BMI,
INDICES = age.gr,
FUN = descr,
stats = c("mean", "sd", "min", "med", "max"))
)
library(dplyr)
tobacco$gender %<>% forcats::fct_explicit_na()
tobacco %>%
group_by(gender) %>%
descr(stats = "fivenum")
library(magrittr)
iris %>%
descr(stats = "common") %>%
tb()