collect: Collecting SSI outputs

View source: R/collect.R

Collecting SSI outputsR Documentation

Collecting SSI outputs

Description

Collects all outputs saved at the provided save.at parameter from the SSI analysis when testing data was splited according to argument subset.

Usage

collect(path = "")

Arguments

path

(character) Path where output files were saved, this may include a prefix

Value

An object of the class 'SSI' for which methods fitted, plot and summary exist

Examples

  require(SFSI)
  data(wheatHTP)
  
  index = which(Y$trial %in% 1:8)      # Use only a subset of data
  Y = Y[index,]
  M = scale(M[index,])/sqrt(ncol(M))   # Subset and scale markers
  G = tcrossprod(M)                    # Genomic relationship matrix
  y = as.vector(scale(Y[,"E1"]))       # Response variable

  # Sets (testing=0, training=1)
  trn_tst = ifelse(Y$trial %in% 1:2, 0, 1)
  
  path = paste0(tempdir(),"/testSSI_")
  
  # Run the analysis into 4 subsets and save them at a given path
  fm = SSI(y,K=G,trn_tst=trn_tst,subset=c(1,4),save.at=path)
  fm = SSI(y,K=G,trn_tst=trn_tst,subset=c(2,4),save.at=path)
  fm = SSI(y,K=G,trn_tst=trn_tst,subset=c(3,4),save.at=path)
  fm = SSI(y,K=G,trn_tst=trn_tst,subset=c(4,4),save.at=path)

  # Collect all results after completion
  fm = collect(path)

SFSI documentation built on Nov. 18, 2023, 9:06 a.m.