extract_variables: Extract Variables of Specific Types from a given Dataset

Description Usage Arguments Value See Also Examples

Description

This function extracts variables of specific types from a given dataset. Variables that are either numeric, factor or character are extracted. Furthermore, all variables except the specified type can be extracted also. The results are outputed as a data frame. These results can be saved to a specified directory as a .csv file.

Usage

1
2
extract_variables(dataset, type = c("numeric", "factor", "character"),
  extract_not = FALSE, file_name = NULL, directory = NULL)

Arguments

dataset

A dataset from which the categorical variables are extracted

type

The type of data type to be extracted from the dataset. One of three; "numeric", "factor", "character" Default is "numeric"

extract_not

A logical object indicting whether all but the specified data type should be extracted. Default is FALSE.

file_name

A character object indicating the file name when saving the data frame. The default is NULL. The name must include the .csv suffixs.

directory

A character object specifying the directory where the data frame is to be saved as a .csv file.

Value

Outputs the categorical variables as a data frame.

See Also

remove_variables, derive_variables, impute_variables, standardise_variables, transform_variables

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Example - titanic

# Extract the Numeric Variables
extract_variables(dataset = titanic, type = "numeric")

# Extract the Factor Variables
extract_variables(dataset = titanic, type = "factor")

Extract all but the Character Variables
extract_variables(dataset = titanic, type = "character", extract_not = FALSE)

oislen/BuenaVista documentation built on May 16, 2019, 8:12 p.m.