library(tidyverse)
## -- Attaching packages ------------------- tidyverse 1.3.0 --
## √ ggplot2 3.3.2 √ purrr 0.3.4
## √ tibble 3.0.3 √ dplyr 1.0.2
## √ tidyr 1.1.2 √ stringr 1.4.0
## √ readr 1.3.1 √ forcats 0.5.0
## -- Conflicts ---------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
ggplot(data = diamonds,
mapping = aes(x = carat, y = price)) +
geom_point() +
geom_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
devtools::install_github('rapporter/pander')
## Skipping install of 'pander' from a github remote, the SHA1 (cb2f8bcd) has not changed since last install.
## Use `force = TRUE` to force installation
library(summarytools)
## Registered S3 method overwritten by 'pryr':
## method from
## print.bytes Rcpp
##
## Attaching package: 'summarytools'
## The following object is masked from 'package:tibble':
##
## view
view(dfSummary(iris))
## Switching method to 'browser'
## Output file written: C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkDJ94q\file31b470397af8.html
dfSummary(iris)
## Data Frame Summary
## iris
## Dimensions: 150 x 5
## Duplicates: 1
##
## ---------------------------------------------------------------------------------------------------------
## No Variable Stats / Values Freqs (% of Valid) Graph Valid Missing
## ---- -------------- ----------------------- -------------------- --------------------- -------- ---------
## 1 Sepal.Length Mean (sd) : 5.8 (0.8) 35 distinct values . . : : 150 0
## [numeric] min < med < max: : : : : (100%) (0%)
## 4.3 < 5.8 < 7.9 : : : : :
## IQR (CV) : 1.3 (0.1) : : : : :
## : : : : : : : :
##
## 2 Sepal.Width Mean (sd) : 3.1 (0.4) 23 distinct values : 150 0
## [numeric] min < med < max: : (100%) (0%)
## 2 < 3 < 4.4 . :
## IQR (CV) : 0.5 (0.1) : : : :
## . . : : : : : :
##
## 3 Petal.Length Mean (sd) : 3.8 (1.8) 43 distinct values : 150 0
## [numeric] min < med < max: : . : (100%) (0%)
## 1 < 4.3 < 6.9 : : : .
## IQR (CV) : 3.5 (0.5) : : : : : .
## : : . : : : : : .
##
## 4 Petal.Width Mean (sd) : 1.2 (0.8) 22 distinct values : 150 0
## [numeric] min < med < max: : (100%) (0%)
## 0.1 < 1.3 < 2.5 : . . :
## IQR (CV) : 1.5 (0.6) : : : : .
## : : : : : . : : :
##
## 5 Species 1. setosa 50 (33.3%) IIIIII 150 0
## [factor] 2. versicolor 50 (33.3%) IIIIII (100%) (0%)
## 3. virginica 50 (33.3%) IIIIII
## ---------------------------------------------------------------------------------------------------------
view(dfSummary(diamonds))
## Switching method to 'browser'
## Output file written: C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkDJ94q\file31b430953940.html
view(descr(iris))
## Warning: `funs()` is deprecated as of dplyr 0.8.0.
## Please use a list of either functions or lambdas:
##
## # Simple named list:
## list(mean = mean, median = median)
##
## # Auto named with `tibble::lst()`:
## tibble::lst(mean, median)
##
## # Using lambdas
## list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
## Non-numerical variable(s) ignored: Species
## Switching method to 'browser'
## Output file written: C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkDJ94q\file31b480f3087.html
view(descr(diamonds))
## Non-numerical variable(s) ignored: cut, color, clarity
## Switching method to 'browser'
## Output file written: C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkDJ94q\file31b450451fcc.html
view(dfSummary(diamonds, plain.ascii = FALSE, style = "grid",
graph.magnif = 0.75, valid.col = FALSE, tmp.img.dir = "/tmp"))
## temporary images written to 'E:\tmp'
## Switching method to 'browser'
## Output file written: C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkDJ94q\file31b41c837e51.html
library(DataExplorer)
create_report(iris)
##
##
## processing file: report.rmd
##
|
| | 0%
|
|.. | 2%
## inline R code fragments
##
##
|
|... | 5%
## label: global_options (with options)
## List of 1
## $ include: logi FALSE
##
##
|
|..... | 7%
## ordinary text without R code
##
##
|
|....... | 10%
## label: introduce
##
|
|........ | 12%
## ordinary text without R code
##
##
|
|.......... | 14%
## label: plot_intro
##
|
|............ | 17%
## ordinary text without R code
##
##
|
|............. | 19%
## label: data_structure
##
|
|............... | 21%
## ordinary text without R code
##
##
|
|................. | 24%
## label: missing_profile
##
|
|.................. | 26%
## ordinary text without R code
##
##
|
|.................... | 29%
## label: univariate_distribution_header
##
|
|...................... | 31%
## ordinary text without R code
##
##
|
|....................... | 33%
## label: plot_histogram
##
|
|......................... | 36%
## ordinary text without R code
##
##
|
|........................... | 38%
## label: plot_density
##
|
|............................ | 40%
## ordinary text without R code
##
##
|
|.............................. | 43%
## label: plot_frequency_bar
##
|
|................................ | 45%
## ordinary text without R code
##
##
|
|................................. | 48%
## label: plot_response_bar
##
|
|................................... | 50%
## ordinary text without R code
##
##
|
|..................................... | 52%
## label: plot_with_bar
##
|
|...................................... | 55%
## ordinary text without R code
##
##
|
|........................................ | 57%
## label: plot_normal_qq
##
|
|.......................................... | 60%
## ordinary text without R code
##
##
|
|........................................... | 62%
## label: plot_response_qq
##
|
|............................................. | 64%
## ordinary text without R code
##
##
|
|............................................... | 67%
## label: plot_by_qq
##
|
|................................................ | 69%
## ordinary text without R code
##
##
|
|.................................................. | 71%
## label: correlation_analysis
##
|
|.................................................... | 74%
## ordinary text without R code
##
##
|
|..................................................... | 76%
## label: principal_component_analysis
##
|
|....................................................... | 79%
## ordinary text without R code
##
##
|
|......................................................... | 81%
## label: bivariate_distribution_header
##
|
|.......................................................... | 83%
## ordinary text without R code
##
##
|
|............................................................ | 86%
## label: plot_response_boxplot
##
|
|.............................................................. | 88%
## ordinary text without R code
##
##
|
|............................................................... | 90%
## label: plot_by_boxplot
##
|
|................................................................. | 93%
## ordinary text without R code
##
##
|
|................................................................... | 95%
## label: plot_response_scatterplot
##
|
|.................................................................... | 98%
## ordinary text without R code
##
##
|
|......................................................................| 100%
## label: plot_by_scatterplot
## output file: E:/course/report.knit.md
## "C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS "E:/course/report.utf8.md" --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc31b47f5b7ac2.html --email-obfuscation none --self-contained --standalone --section-divs --table-of-contents --toc-depth 6 --template "D:\Rlib\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:yeti" --include-in-header "C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkDJ94q\rmarkdown-str31b42efe3562.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --lua-filter "D:/Rlib/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter "D:/Rlib/rmarkdown/rmd/lua/latex-div.lua"
##
## Output created: report.html
# https://m-clark.github.io/exploratory-data-analysis-tools/
library(gtsummary)
## #Uighur
mpg %>%
tbl_summary()
| Characteristic | N = 2341 |
|---|---|
| manufacturer | |
| audi | 18 (7.7%) |
| chevrolet | 19 (8.1%) |
| dodge | 37 (16%) |
| ford | 25 (11%) |
| honda | 9 (3.8%) |
| hyundai | 14 (6.0%) |
| jeep | 8 (3.4%) |
| land rover | 4 (1.7%) |
| lincoln | 3 (1.3%) |
| mercury | 4 (1.7%) |
| nissan | 13 (5.6%) |
| pontiac | 5 (2.1%) |
| subaru | 14 (6.0%) |
| toyota | 34 (15%) |
| volkswagen | 27 (12%) |
| model | |
| 4runner 4wd | 6 (2.6%) |
| a4 | 7 (3.0%) |
| a4 quattro | 8 (3.4%) |
| a6 quattro | 3 (1.3%) |
| altima | 6 (2.6%) |
| c1500 suburban 2wd | 5 (2.1%) |
| camry | 7 (3.0%) |
| camry solara | 7 (3.0%) |
| caravan 2wd | 11 (4.7%) |
| civic | 9 (3.8%) |
| corolla | 5 (2.1%) |
| corvette | 5 (2.1%) |
| dakota pickup 4wd | 9 (3.8%) |
| durango 4wd | 7 (3.0%) |
| expedition 2wd | 3 (1.3%) |
| explorer 4wd | 6 (2.6%) |
| f150 pickup 4wd | 7 (3.0%) |
| forester awd | 6 (2.6%) |
| grand cherokee 4wd | 8 (3.4%) |
| grand prix | 5 (2.1%) |
| gti | 5 (2.1%) |
| impreza awd | 8 (3.4%) |
| jetta | 9 (3.8%) |
| k1500 tahoe 4wd | 4 (1.7%) |
| land cruiser wagon 4wd | 2 (0.9%) |
| malibu | 5 (2.1%) |
| maxima | 3 (1.3%) |
| mountaineer 4wd | 4 (1.7%) |
| mustang | 9 (3.8%) |
| navigator 2wd | 3 (1.3%) |
| new beetle | 6 (2.6%) |
| passat | 7 (3.0%) |
| pathfinder 4wd | 4 (1.7%) |
| ram 1500 pickup 4wd | 10 (4.3%) |
| range rover | 4 (1.7%) |
| sonata | 7 (3.0%) |
| tiburon | 7 (3.0%) |
| toyota tacoma 4wd | 7 (3.0%) |
| displ | 3.30 (2.40, 4.60) |
| year | |
| 1999 | 117 (50%) |
| 2008 | 117 (50%) |
| cyl | |
| 4 | 81 (35%) |
| 5 | 4 (1.7%) |
| 6 | 79 (34%) |
| 8 | 70 (30%) |
| trans | |
| auto(av) | 5 (2.1%) |
| auto(l3) | 2 (0.9%) |
| auto(l4) | 83 (35%) |
| auto(l5) | 39 (17%) |
| auto(l6) | 6 (2.6%) |
| auto(s4) | 3 (1.3%) |
| auto(s5) | 3 (1.3%) |
| auto(s6) | 16 (6.8%) |
| manual(m5) | 58 (25%) |
| manual(m6) | 19 (8.1%) |
| drv | |
| 4 | 103 (44%) |
| f | 106 (45%) |
| r | 25 (11%) |
| cty | 17 (14, 19) |
| hwy | 24 (18, 27) |
| fl | |
| c | 1 (0.4%) |
| d | 5 (2.1%) |
| e | 8 (3.4%) |
| p | 52 (22%) |
| r | 168 (72%) |
| class | |
| 2seater | 5 (2.1%) |
| compact | 47 (20%) |
| midsize | 41 (18%) |
| minivan | 11 (4.7%) |
| pickup | 33 (14%) |
| subcompact | 35 (15%) |
| suv | 62 (26%) |
|
1
Statistics presented: n (%); median (IQR)
|
|
#https://cran.r-project.org/web/packages/gtsummary/index.html