Skip to content

Commit

Permalink
remove comments in example script
Browse files Browse the repository at this point in the history
  • Loading branch information
choonghyunryu committed Feb 3, 2024
1 parent 8330b29 commit ace796d
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 119 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: dlookr
Type: Package
Title: Tools for Data Diagnosis, Exploration, Transformation
Version: 0.6.3
Date: 2024-01-13
Date: 2024-02-03
Authors@R: c(
person("Choonghyun", "Ryu",, "[email protected]", role = c("aut", "cre"))
)
Expand Down
22 changes: 3 additions & 19 deletions R/compare.R
Original file line number Diff line number Diff line change
Expand Up @@ -870,43 +870,27 @@ print.compare_numeric <- function(x, ...) {
#' @return NULL. This function just draws a plot.
#' @seealso \code{\link{compare_category}}, \code{\link{print.compare_category}}, \code{\link{summary.compare_category}}.
#' @examples
#' \donttest{
#' # Generate data for the example
#' heartfailure2 <- heartfailure
#' heartfailure2 <- heartfailure[, c("hblood_pressure", "smoking", "death_event")]
#' heartfailure2[sample(seq(NROW(heartfailure2)), 5), "smoking"] <- NA
#'
#' library(dplyr)
#'
#' # Compare the all categorical variables
#' all_var <- compare_category(heartfailure2)
#'
#' # Print compare_numeric class objects
#' all_var
#' # plot all pair of variables
#' plot(all_var)
#'
#' # Compare the two categorical variables
#' two_var <- compare_category(heartfailure2, smoking, death_event)
#'
#' # Print compare_category class objects
#' two_var
#'
#' # plot all pair of variables
#' # plot(all_var)
#'
#' # plot a pair of variables
#' plot(two_var)
#'
#' # plot all pair of variables by prompt
#' plot(all_var, prompt = TRUE)
#'
#' # plot a pair of variables without NA
#' plot(two_var, na.rm = TRUE)
#'
#' # plot a pair of variables
#' plot(two_var, las = 1)
#'
#' # plot a pair of variables not focuses on typographic elements
#' plot(two_var, typographic = FALSE)
#' }
#'
#' @method plot compare_category
#' @export
Expand Down
22 changes: 4 additions & 18 deletions R/imputation.R
Original file line number Diff line number Diff line change
Expand Up @@ -628,38 +628,24 @@ summary.imputation <- function(object, ...) {
#' @return A ggplot2 object.
#' @seealso \code{\link{imputate_na}}, \code{\link{imputate_outlier}}, \code{\link{summary.imputation}}.
#' @examples
#' \donttest{
#' # Generate data for the example
#' heartfailure2 <- heartfailure
#' heartfailure2[sample(seq(NROW(heartfailure2)), 20), "platelets"] <- NA
#' heartfailure2[sample(seq(NROW(heartfailure2)), 5), "smoking"] <- NA
#'
#' # Impute missing values -----------------------------
#' # If the variable of interest is a numerical variables
#' # Require rpart package
#' # platelets <- imputate_na(heartfailure2, platelets, death_event, method = "rpart")
#' # platelets
#' # summary(platelets)
#'
#' # plot(platelets)
#' platelets <- imputate_na(heartfailure2, platelets, yvar = death_event, method = "rpart")
#' plot(platelets)
#'
#' # If the variable of interest is a categorical variables
#' # The "mice" method must require the `mice`, `ranger` package.
#' # If you want to use this feature, you need to install the `mice` and `ranger` package.
#' # smoking <- imputate_na(heartfailure2, smoking, death_event, method = "mice")
#' # smoking
#' # summary(smoking)
#'
#' # plot(smoking)
#' smoking <- imputate_na(heartfailure2, smoking, yvar = death_event, method = "rpart")
#' plot(smoking)
#'
#' # Impute outliers ----------------------------------
#' # If the variable of interest is a numerical variable
#' platelets <- imputate_outlier(heartfailure2, platelets, method = "capping")
#' platelets
#' summary(platelets)
#'
#' plot(platelets)
#' }
#' @method plot imputation
#' @import ggplot2
#' @import hrbrthemes
Expand Down
40 changes: 18 additions & 22 deletions R/transform.R
Original file line number Diff line number Diff line change
Expand Up @@ -353,28 +353,24 @@ plot.transform <- function(x, typographic = TRUE, base_family = NULL, ...) {
#' @return No return value. This function only generates a report.
#'
#' @examples
#' \donttest{
#' #if (FALSE) {
#' #if (!require(prettydoc)) install.packages('prettydoc', repos = "http://cran.us.r-project.org")
#' #
#' ## reporting the Binning information -------------------------
#' ## create pdf file. file name is Transformation_Report.pdf & No target variable
#' #transformation_report(heartfailure)
#' #
#' ## create pdf file. file name is Transformation_Report.pdf
#' #transformation_report(heartfailure, death_event)
#' #
#' ## create pdf file. file name is Transformation_heartfailure.pdf
#' #transformation_report(heartfailure, "death_event",
#' # output_file = "Transformation_heartfailure.pdf")
#' #
#' ## create html file. file name is Transformation_Report.html
#' #transformation_report(heartfailure, "death_event", output_format = "html")
#' #
#' ## create html file. file name is Transformation_heartfailure.html
#' #transformation_report(heartfailure, death_event, output_format = "html",
#' # output_file = "Transformation_heartfailure.html")
#' #}
#' if (FALSE) {
#' # reporting the Binning information -------------------------
#' # create pdf file. file name is Transformation_Report.pdf & No target variable
#' transformation_report(heartfailure)
#'
#' # create pdf file. file name is Transformation_Report.pdf
#' transformation_report(heartfailure, death_event)
#'
#' # create pdf file. file name is Transformation_heartfailure.pdf
#' transformation_report(heartfailure, "death_event",
#' output_file = "Transformation_heartfailure.pdf")
#'
#' # create html file. file name is Transformation_Report.html
#' transformation_report(heartfailure, "death_event", output_format = "html")
#'
#' # create html file. file name is Transformation_heartfailure.html
#' transformation_report(heartfailure, death_event, output_format = "html",
#' output_file = "Transformation_heartfailure.html")
#' }
#'
#' @importFrom knitr knit2pdf
Expand Down
22 changes: 3 additions & 19 deletions man/plot.compare_category.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 4 additions & 18 deletions man/plot.imputation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 18 additions & 22 deletions man/transformation_report.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ace796d

Please sign in to comment.