distVarFunc: distVarFunc

Description Usage Arguments Value Examples

View source: R/distVarFunc.R

Description

distVarFunc takes as input a data.frame object dfData, a character vector containing column names (dfColNameVec), a character string indicating the name of the output subdirectory (subDir) and returns plots of the empirical cumulative frequency distribution, one for the data in each of the columns in dfColName of dfData considering the length of the column as total population. The plots are saved in the subdirectory subDir inside the "plot" directory within the current working directory. A data.frame object containing columns from the original data.frame object dfData which have class factor or class numeric is also created and saved as a .xlsx file in the subdirectory subDir inside the "output" directory within the current working directory. "output" and/or "plot" directories are created in the current working directory if not present already. Similarly, if subDir is specified, a subdirectory with the name subDir is created within both output/ and plot/ if not already present, and the outputs are saved in that subdirectory. If a subdirectory is not specified (i.e. missing subDir), then the output .xlsx file is saved in output/ and the plot is saved in plot/.

Usage

1
distVarFunc(dfData, dfColNameVec, subDir, envir = .GlobalEnv)

Arguments

dfData

a data.frame object or a character string indicating the name of the data.frame object.

dfColNameVec

a string or a vector of class character indicating the name(s) of the column(s) to be plotted.

subDir

a character string indicating the name of the subdirectory "output" and "plot" directories to save the output data.frame object (as a .xlsx file) and plot (as a .png file) respectively. If a subdirectory with the given name does not exist within output and/or plot, then it is created. If not specified, the outputs are saved in output/ and plot/.

envir

a variable indicating the environment where the output data.frame object should be saved.

Value

distVarFunc returns plots of the empirical cumulative frequency distribution, one for the data in each of the columns in dfColNameVec of dfData considering the length of the column as total population. It saves these plots in the subdirectory subDir inside the "plot" directory within the current working directory. It also saves a data.frame object as a .xlsx file with only those columns from the original data.frame object dfData which have class factor or class numeric. It creates "output" and/or "plot" directories in the current working directory if not present already. Similarly, if subDir is specified, it creates a subdirectory with the name subDir within both output/ and plot/ if not already present, and saves the outputs in the respective subdirectories. If a subdirectory is not specified (i.e. missing subDir), then it saves the output .xlsx file in output/ and the plot in plot/.

Examples

1
2
distVarFunc(iris,"Sepal.Length")
distVarFunc(iris,c("Sepal.Width","Sepal.Length"),"new_plots")

lwTools/agriTrf documentation built on March 26, 2020, 12:09 a.m.