output_standardized: Standardize select variables within dataframe

Description Usage Arguments Value Author(s) Examples

View source: R/output_standardized.R

Description

This function standardized specified columns within a dataframe to have a mean of 0 and a standard deviation of 1. The standardized dataframe is exported to a tab separated file of a provided name. The mean and variance, used to standardize the dataframe, are outputted to a separate file.

Usage

1
output_standardized(datafile, col_names, filename, should_append = FALSE)

Arguments

datafile

A dataframe input containing data for standardization.

col_names

A list of column names corresponding to the inputted dataset, specifies which columns to standardize.

filename

A character string denoting the name of the outputted files.

should_append

A boolean variable denoting if the outputted files should overwrite existing files or be appended to existing files.

Value

Returns a transposed matrix of standardized data. Exports a the standardized dataframe to a tab separated file. Exports coefficients used to standardize data to a separate tab separated file.

Author(s)

Brent Murphy

Examples

1
2
3
4
5
6
7
test1 <-data.frame(x = c(1,2,3,4,5),
                   y = c(2,4,6,8,10),
                   z = c(15,20,30,40,50))
colnames(test1)<-c("ONE","TWO","THREE")
output_standardized(datafile = test1, 
                    col_names = c("ONE","TWO","THREE"), 
                    filename = "testfiles")

brentpm2/FIELD_PRO_ANALYSIS documentation built on May 7, 2019, 3:20 p.m.