Standardize Data

Description

Converts data to standard normal (mean = 0; SD = 1) - i.e., z-scores.

Usage

1
Make.Z(x)

Arguments

x

Any data object (especially useful for multiple columns of a data.frame).

Details

Takes the data (by columns if necessary) and subtracts out the mean and then divides by the standard deviation. The result is a standard normal z score.

Value

A numeric or matrix containing standardized data (i.e., z scores)

Warning

The result is a matrix. One may wish to convert to data.frame or use as.data.frame(Make.Z(x))

Author(s)

Thomas D. Fletcher tom.fletcher.mp7e@statefarm.com

Examples

1
2
3
zUSJR <- Make.Z(USJudgeRatings)	# creates new object containg z scores
dim(zUSJR)			# shows that there are 43 observed z scores for 12 variables
zUSJR[,1]			# to look at only the first column of z scores