knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of niceFunction is to retain all random function that I found all over the books, forums, etc.
You can install the the development version from GitHub with:
# install.packages("devtools") devtools::install_github("tengku-hanis/niceFunction")
This is a summary example which shows the use of each function. As of now, this package only have 6 functions:
library(niceFunction) library(dplyr)
histWithCurve give a histogram with a normal density curve.
histWithCurve(iris$Sepal.Length)
histCurve give a ggplot2 histogram with a normal density curve.
histCurve(iris, Sepal.Length)
histNA_byVar assess the distribution of NAs of certain variable is affected by another variable.
dat <- iris dat[dat$Species == "setosa", "Sepal.Length"] <- NA histNA_byVar(dat, Sepal.Length, Sepal.Width)
The histogram with NA values (label by True) indicate a right-tailed missingness compared to the histogram with no NAs (label by False).
regDiag is used for screening of outliers and influential cases.
# Create some outlier observations iris[151, ] <- c(9, 9, 9, 9, "virginica") iris <- iris %>% mutate(across(c(Sepal.Length:Petal.Width), as.numeric)) mod <- lm(Sepal.Length ~ Species + Sepal.Width, data = iris) regDiag(mod)
True indicate the presence of outliers and/or influential cases according to that metrics and vice-versa.
read_excel_allsheets read all excel sheets or several excel sheets.
## Read all excel sheets (not run) # read_excel_allsheets("datasets") ## Read several excel sheets (not run) # read_excel_allsheets("datasets", pages = 2:5)
changeType change the variable type across list of data frames.
# Make a list iris_list <- list(iris1 = iris, iris2 = iris) # Change one variable type iris_list <- lapply(iris_list, changeType, Var = "Sepal.Width", funct = "as.character") # Change 2 variables type iris_list <- lapply(iris_list, changeType, Var = c("Sepal.Length", "Species"), funct = "as.character")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.