Learn R Programming

bootsPLS (version 1.1.2)

compile.bootsPLS.object: Combine several bootsPLS objects into one

Description

Combine several bootsPLS objects into one

Usage

compile.bootsPLS.object(bootsPLS.list,path,pattern,file,save.file)

Arguments

bootsPLS.list

A list of bootsPLS object, as obtained from multiple calls to bootsPLS

path

Only used if bootsPLS.list is missing. A path to the Rdata files containing the bootsPLS outputs to combine. Will be passed in the list.files function.

pattern

Only used if bootsPLS.list is missing. A commun pattern to the Rdata files to combine. Will be passed in the list.files function.

file

Only used if bootsPLS.list is missing. Vector of Rdata files to combine. Will be loaded as path/file[i]

save.file

Optional. Full path of the Rdata file to be saved with the combined objects.

Value

A 'bootsPLS' object is returned for which plot, fit.model and prediction are available. See bootsPLS for the outputs.

Details

This function works with either a list of bootsPLS object, a path and a pattern or a path and a file. The outputs can be saved into a Rdata file. See Examples below.

See Also

plot.bootsPLS, fit.model, prediction, bootsPLS

Examples

Run this code
# NOT RUN {
data(MSC)
X=MSC$X
Y=MSC$Y
dim(X)
table(Y)

# perform several bootsPLS analysis
boot1=bootsPLS(X=X,Y=Y,ncomp=3,many=5,kCV=5)
boot2=bootsPLS(X=X,Y=Y,ncomp=3,many=5,kCV=5,showProgress=FALSE)
boot3=bootsPLS(X=X,Y=Y,ncomp=3,many=5,kCV=5,showProgress=FALSE)

# construct a list of bootsPLS object
bootsPLS.object=list(boot1,boot2,boot3)

# compile the outputs in one bootsPLS object
boot=compile.bootsPLS.object(bootsPLS.object)


# =======================================
# all can work from the saved file:
# =======================================
#convenient if used on a cluster

# perform several bootsPLS analysis and save the outputs
boot1=bootsPLS(X=X,Y=Y,ncomp=3,many=5,kCV=5,save.file="MSC1.Rdata")
boot2=bootsPLS(X=X,Y=Y,ncomp=3,many=5,kCV=5,showProgress=FALSE,save.file="MSC2.Rdata")
boot3=bootsPLS(X=X,Y=Y,ncomp=3,many=5,kCV=5,showProgress=FALSE,save.file="MSC3.Rdata")

# compile the outputs in one bootsPLS object
boot=compile.bootsPLS.object(path=paste(getwd(),"/",sep=""),
    pattern="MSC",save.file="MSC.all.Rdata")

# or
boot=compile.bootsPLS.object(path=paste(getwd(),"/",sep=""),
    file=c("MSC1.Rdata","MSC2.Rdata","MSC3.Rdata"),save.file="MSC.all.Rdata")


# }

Run the code above in your browser using DataLab