alex_dataframe_descriptive_table: alex_dataframe_descriptive_table

Description Usage Arguments Value Note Examples

View source: R/alex_dataframe_descriptive_table.R

Description

Reads a data frame and reports descriptive statistics (n, mean, standard deviation, minimum, first quartile, median, third quartile, maximum) for all members of the data frame that are either numeric or logical. The thinking engine is motivated by EpanDar package. But this function is improved here in performance and functionality. This function is created by Alexander Shemetev.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
alex_dataframe_descriptive_table(
  df,
  digitsx = c(0, 2, 2, 2, 2, 2, 2, 2),
  format = "html",
  my_path = getwd(),
  my_file = "my_html_descr_table.html",
  showhtmlinR = FALSE,
  open_in_browser = TRUE,
  showdf = FALSE,
  save_excel = TRUE
)

Arguments

df

Data frame containing at least one variable that is either numeric or logical and at least two observations.

digitsx

Number of decimal digits that you want to be displayed for each column. If you provide NA, then the column is omitted from the output. By default these are 2 digits after the dot: digitsx = c(0, 2, 2, 2, 2, 2, 2, 2)

format

character scalar that is handed over to kable (e.g., "html" or "latex").

my_path

Path where to save your data to in format like: C:/Users/Alex/Documents/NewRPackage/alexandershemetev; format C:/Users/Alex/Documents/NewRPackage/alexandershemetev/ should also be processed by default, this is your current working directory @param my_file is the name of the output .html file your want to save your descriptive table to by default, the name of the file is: my_html_descr_table.html.html (the first .html is for windows users whose OS doesn't provide extension obviously they could easily work with the file in their environment)

showhtmlinR

TRUE/FALSE (by default it is FALSE); if TRUE it will show the HTML code of this table for inputting in HTML page in some web-development environment. This function is mostly designed for the web-developers they could easily put these tables to their web-pages inside some more complicated design page.

open_in_browser

TRUE/FALSE (by default it is TRUE); if TRUE it will open in browser in your local environment the descriptive statistics of your dataframe for further work with.

showdf

TRUE/FALSE (by default it is FALSE) - if it should save your descriptive table data to dataframe to your global environment

save_excel

TRUE/FALSE (by default it is TRUE) - if your descriptive table data should be saved in excel format to work with it in the future.

Value

A list containing two items in global environment.

"df"

A data frame containing the descriptive table

"kable_ret"

The return value provided by kable containing the formatted table

Also it returns a dataframe containing the descriptive table if requested by the user It can also return html file and/or output containing the descriptive table if requested by the user And it can also create Excel file output containing the descriptive table if requested by the user The function will be saying what it is doing in your R environment - all returns will be said.

Note

The function uses "knitr", "plyr", "dplyr", "kableExtra", "htmltools", "utils", "pander", "writexl" libraries which will be installed and/or opened in your R environment even if they are not installed yet. This process is automatic (but user may be asked to select a mirror to download absent packages, if any). t1_12_28_90 - is the basic name of the returned list and t1_12_28_90_df is the basic name of the returned dataframe. Everything returned or created into the system is also said in R environment by this function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
alex_dataframe_descriptive_table(mtcars)
fcm <-c(14.0,14.1,13.0,14,2,14.7,13.8,14.0)
gk  <-c(12.1,12.5,12.2,12,0,11.5,12.0,11.4)
gg  <-c(14.0,14.1,13,3,12.8,12.0,12.2,12.0)
fcm1 <-c(14.0,14.1,13.0,14,2,14.7,13.8,14.0)
gk1  <-c(12.1,12.5,12.2,12,0,11.5,12.0,11.4)
gg1  <-c(14.0,14.1,13,3,12.8,12.0,12.2,12.0)
fcm2 <-c(14.0,14.1,13.0,14,2,14.7,13.8,14.0)
gk2  <-c(12.1,12.5,12.2,12,0,11.5,12.0,11.4)
gg2  <-c(14.0,14.1,13,3,12.8,12.0,12.2,12.0)
data1 <- rbind(fcm,gk,gg, fcm1,gk1,gg1,fcm2,gk2,gg2)
colnames(data1) <- c(6:13)
alex_dataframe_descriptive_table(data1)

Alexandershemetev/alexandershemetev documentation built on Dec. 30, 2020, 9:47 p.m.