selectExclude: selectExclude

Description Usage Arguments Value Examples

View source: R/selectExclude.R

Description

selectExclude takes as input a date.frame object or a data.frame object name (dfData), a character vector containing column names (dfColNameVec), a suffix (suffix) and the name of the output subdirectory (subDir) and selects all columns from dfData except the ones specified in dfColNameVec. The non-excluded columns are saved as a data.frame object in a .rda file in the subDir subdirectory in the main directory called "input". If the directory called "input" is not present in the current working directory, a new directory called "input" is created. If a subdirectory is not specified (i.e. missing subDir), then the output .rda file is saved in input/. The output data.frame object is also saved in the ". GlobalEnv" environment and the name of the output data.frame object is returned in the console.

Usage

1
selectExclude(dfData, dfColNameVec, suffix, 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 excluded.

suffix

a string (default: "excluded") of class character indicating the suffix to be added to the name of the original data.frame object name to obtain the name of the output data.frame object.

subDir

a character string indicating the name of the subdirectory to save the output data.frame object as a .rda file

envir

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

Value

selectExclude creates a data.frame object containing all columns except the ones specified by dfColNameVec from the data.frame object dfData and saves it as a .rda file in the subdirectory called subDir inside the directory called "input". If the "input" directory is not present in the current working directory, an "input" directory is created and the output .rda file is saved therein. It also saves the data.frame object in the ". GlobalEnv" environment and returns the name of the output data.frame object in the console.

Examples

1
2
selectExclude(employees,c("emp_id","emp_name","start_date"),"filtered","results")
selectExclude(employees,c("emp_id","emp_name","date_of_birth"))

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