Codes for overviewing the data.^[See childRmd/_07overView.Rmd
file for other codes]
View(mydata)
reactable::reactable(data = mydata, sortable = TRUE, resizable = TRUE, filterable = TRUE, searchable = TRUE, pagination = TRUE, paginationType = "numbers", showPageSizeOptions = TRUE, highlight = TRUE, striped = TRUE, outlined = TRUE, compact = TRUE, wrap = FALSE, showSortIcon = TRUE, showSortable = TRUE)
Summary of Data via summarytools 📦
summarytools::view(summarytools::dfSummary(mydata %>% dplyr::select(-keycolumns)))
if(!dir.exists(here::here("out"))) {dir.create(here::here("out"))} summarytools::view( x = summarytools::dfSummary( mydata %>% dplyr::select(-keycolumns) ), file = here::here("out", "mydata_summary.html") )
Summary via dataMaid 📦
if(!dir.exists(here::here("out"))) {dir.create(here::here("out"))} dataMaid::makeDataReport(data = mydata, file = here::here("out", "dataMaid_mydata.Rmd"), replace = TRUE, openResult = FALSE, render = FALSE, quiet = TRUE )
Summary via explore 📦
if(!dir.exists(here::here("out"))) {dir.create(here::here("out"))} mydata %>% dplyr::select( -dateVariables ) %>% explore::report( output_file = "mydata_report.html", output_dir = here::here("out") )
Glimpse of Data
dplyr::glimpse(mydata %>% dplyr::select(-keycolumns, -dateVariables))
mydata %>% explore::describe()
Explore
explore::explore(mydata)
mydata %>% explore::explore_all()
Control Data if matching expectations
visdat::vis_expect(data = mydata, expectation = ~.x == -1, show_perc = TRUE) visdat::vis_expect(mydata, ~.x >= 25)
See missing values
visdat::vis_miss(airquality, cluster = TRUE)
visdat::vis_miss(airquality, sort_miss = TRUE)
xray::anomalies(mydata)
xray::distributions(mydata)
Summary of Data via DataExplorer 📦
DataExplorer::plot_str(mydata)
DataExplorer::plot_str(mydata, type = "r")
DataExplorer::introduce(mydata)
DataExplorer::plot_intro(mydata)
DataExplorer::plot_missing(mydata)
Drop columns
mydata2 <- DataExplorer::drop_columns(mydata, "TStage")
DataExplorer::plot_bar(mydata)
DataExplorer::plot_bar(mydata, with = "Death")
DataExplorer::plot_histogram(mydata)
if(!dir.exists(here::here("out"))) {dir.create(here::here("out"))} # https://cran.r-project.org/web/packages/dataMaid/vignettes/extending_dataMaid.html library("dataMaid") dataMaid::makeDataReport(mydata, #add extra precheck function preChecks = c("isKey", "isSingular", "isSupported", "isID"), #Add the extra summaries - countZeros() for character, factor, #integer, labelled and numeric variables and meanSummary() for integer, #numeric and logical variables: summaries = setSummaries( character = defaultCharacterSummaries(add = "countZeros"), factor = defaultFactorSummaries(add = "countZeros"), labelled = defaultLabelledSummaries(add = "countZeros"), numeric = defaultNumericSummaries(add = c("countZeros", "meanSummary")), integer = defaultIntegerSummaries(add = c("countZeros", "meanSummary")), logical = defaultLogicalSummaries(add = c("meanSummary")) ), #choose mosaicVisual() for categorical variables, #prettierHist() for all others: visuals = setVisuals( factor = "mosaicVisual", numeric = "prettierHist", integer = "prettierHist", Date = "prettierHist" ), #Add the new checkFunction, identifyColons, for character, factor and #labelled variables: checks = setChecks( character = defaultCharacterChecks(add = "identifyColons"), factor = defaultFactorChecks(add = "identifyColons"), labelled = defaultLabelledChecks(add = "identifyColons") ), #overwrite old versions of the report, render to html and don't #open the html file automatically: replace = TRUE, output = "html", open = FALSE, file = here::here("out/dataMaid_mydata.Rmd") )
# https://cran.r-project.org/web/packages/summarytools/vignettes/Recommendations-rmarkdown.html # https://github.com/dcomtois/summarytools library(knitr) opts_chunk$set(comment=NA, prompt=FALSE, cache=FALSE, echo=TRUE, results='asis' # add to individual summarytools chunks )
library(summarytools) st_css()
st_options(bootstrap.css = FALSE, # Already part of the theme so no need for it plain.ascii = FALSE, # One of the essential settings style = "rmarkdown", # Idem. dfSummary.silent = TRUE, # Suppresses messages about temporary files footnote = NA, # Keeping the results minimalistic subtitle.emphasis = FALSE) # For the vignette theme, this gives # much better results. Your mileage may vary.
summarytools::freq(iris$Species, plain.ascii = FALSE, style = "rmarkdown") summarytools::freq(iris$Species, report.nas = FALSE, headings = FALSE, cumul = TRUE, totals = TRUE) summarytools::freq(tobacco$gender, style = 'rmarkdown') summarytools::freq(tobacco[ ,c("gender", "age.gr", "smoker")])
print(freq(tobacco$gender), method = 'render')
view(dfSummary(iris))
dfSummary(tobacco, style = 'grid', graph.magnif = 0.75, tmp.img.dir = "/tmp") dfSummary(tobacco, plain.ascii = FALSE, style = "grid", graph.magnif = 0.75, valid.col = FALSE, tmp.img.dir = "/tmp")
print(dfSummary(tobacco, graph.magnif = 0.75), method = 'render')
# https://github.com/rolkra/explore # https://cran.r-project.org/web/packages/explore/vignettes/explore.html # https://cran.r-project.org/web/packages/explore/vignettes/explore_mtcars.html # library(dplyr) # library(explore) explore::explore(mydata) # iris %>% report(output_file = "report.html", output_dir = here::here()) # iris$is_versicolor <- ifelse(iris$Species == "versicolor", 1, 0) # iris %>% # report(output_file = "report.html", # output_dir = here::here(), # target = is_versicolor # # , split = FALSE # )
iris %>% explore::explore_tbl() iris %>% explore::describe_tbl() iris %>% explore::explore(Species) iris %>% explore::explore(Sepal.Length) iris %>% explore::explore(Sepal.Length, target = is_versicolor) iris %>% explore::explore(Sepal.Length, target = is_versicolor, split = FALSE) iris %>% explore::explore(Sepal.Length, target = Species) iris %>% explore::explore(Sepal.Length, target = Petal.Length) %>% %>% explore::explore_all() iris %>% dplyr::select(Sepal.Length, Sepal.Width) %>% explore::explore_all() iris %>% dplyr::select(Sepal.Length, Sepal.Width, is_versicolor) %>% explore::explore_all(target = is_versicolor) iris %>% dplyr::select(Sepal.Length, Sepal.Width, is_versicolor) %>% explore::explore_all(target = is_versicolor, split = FALSE) iris %>% dplyr::select(Sepal.Length, Sepal.Width, Species) %>% explore::explore_all(target = Species) iris %>% dplyr::select(Sepal.Length, Sepal.Width, Petal.Length) %>% explore::explore_all(target = Petal.Length)
iris %>% explore::explore_all()
knitr::opts_current(fig.height=explore::total_fig_height(iris, target = Species)) explore::total_fig_height(iris, target = Species) iris %>% explore::explore_all(target = Species)
iris %>% explore::explore(Sepal.Length, min_val = 4.5, max_val = 7)
iris %>% explore::explore(Sepal.Length, auto_scale = FALSE)
mtcars %>% explore::describe()
# https://cran.r-project.org/web/packages/dlookr/vignettes/EDA.html dlookr::describe(mydata # , # cols = c(statistic) ) # dlookr::describe(carseats, Sales, CompPrice, Income) # dlookr::describe(carseats, Sales:Income) # dlookr::describe(carseats, -(Sales:Income)) mydata %>% dlookr::describe() %>% dplyr::select(variable, skewness, mean, p25, p50, p75) %>% dplyr::filter(!is.na(skewness)) %>% arrange(desc(abs(skewness)))
# https://cran.r-project.org/web/packages/dlookr/vignettes/EDA.html carseats %>% dlookr::eda_report(target = Sales, output_format = "pdf", output_file = "EDA.pdf" )
carseats %>% dlookr::eda_report(target = Sales, output_format = "html", output_file = "EDA.html" )
# install.packages("ISLR") library("ISLR") # install.packages("SmartEDA") library("SmartEDA") ## Load sample dataset from ISLR pacakge Carseats <- ISLR::Carseats ## overview of the data; SmartEDA::ExpData(data=Carseats,type=1) ## structure of the data SmartEDA::ExpData(data=Carseats,type=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.