rgr (version 1.1.15)

gx.rqpca.save: Function to Save PCA Loadings and Scores as .csv files

Description

Function to save PCA matrices following computations by functions gx.mva, gx.mva.closed, gx.robmva, gx.robmva.closed or gx.rotate as ‘.csv’ files. By default appropriate files names are generated and the files saved in the Working Directory.

Usage

gx.rqpca.save(save, ifload = TRUE, ifcntrb = FALSE, ifscore = TRUE, 
	file = NULL)

Arguments

save

a saved object from any of functions gx.mva, gx.mva.closed, gx.robmva, gx.robmva.closed or gx.rotate.

ifload

if ifload = TRUE the PC loadings will be saved. The default is to save the PC loadings.

ifcntrb

if ifcntrb = TRUE the percentage contribution of each variable (communality) to each PC will be saved. The default is not to save this table.

ifscore

if ifscore = TRUE the scores on the PCs will be saved. The default is to save the PC scores.

file

the name of the folder where the files are to be saved, a ‘/’ is appended before the synthesized file name, details of which are displayed on the current device. If no file is specified, the files are saved to the Working Directory.

Value

The last saved table, table.rows, is returned and may be saved as an object if required.

Details

By default the PCA matrices are saved to the Working Directory with a synthesized file name consisting of the name of the saved object from which the matrices are sourced and an appropriate identifying suffix and ‘.csv’. If a folder name has been provided in file, a ‘/’ is appended prior to the synthesized file name. As each matrix is saved its file name is displayed on the current device. When the saved object is from gx.rotate and is the input object both the original and Varimax loadings and PC scores will be saved by default.

See Also

gx.mva, gx.mva.closed, gx.robmva, gx.robmva.closed, gx.rotate.

Examples

Run this code
# NOT RUN {
## Make test data available
data(sind.mat2open)

## Estimate and save robust PCA loadings and scores
sind.save <- gx.robmva.closed(sind.mat2open)
gx.rqpca.save(sind.save)

## NOTE: the example below is commented out
## Save PCA scores for future use
## gx.rqpca.save(sind.save, ifcntrb = TRUE, file = "D:\R_work\Project3")

## Clean-up
rm(sind.save)
# }

Run the code above in your browser using DataLab