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

Description Usage Arguments Details Value See Also Examples

View source: R/compile.bootsPLS.object.R

Description

Combine several bootsPLS objects into one

Usage

1
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.

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.

Value

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

See Also

plot.bootsPLS, fit.model, prediction, bootsPLS

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
## 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")



## End(Not run)

bootsPLS documentation built on May 2, 2019, 2:44 a.m.