RC_plsda_loading: RC_plsda_loading

Description Usage Arguments Details Value Author(s) References Examples

View source: R/RC_plsda_loading.R

Description

Perform a PLS-DA in the same way as RC_PLSDA1 but return the loadings plot of the desired componant.

Usage

1
RC_plsda_loading(Data, Design, ...)

Arguments

Data

Your initial dataframe containing the gene expression or microarray value for examples.

Design

Your dataframe descrining your sample. It should match the Data dataframe.

Name_project

A title name for your project. You should define it as an env variable at the beginning of your work.

comp

The componant you want to plot (1,2,3 ...).

choice1

The main feature you want to use in the PLS-DA. It should be an existing column from your Design dataframe.

choice2

A feature you want to use to do a multilevel PLS-DA. This will be the feature used to correct the first.

Details

If only choice1 is provided then do a single level PLS-DA. If choice2 is provided then do a multi-level PLS-DA corrected for choice2.

Value

Return a graph object

Author(s)

Benjamin Vittrant

References

http://mixomics.org/

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
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
RC_PLSDA1 = function(Data, Design, Name_Project, choice1, choice2 = NULL, ...){
  # Choice1 & choice2, any column from your design file
  # If only choice1 is provided then it's a single level PLS-DA
  # If choice 2 is provided it's a pls-da on choice1 corrected for choice2
  tmp1 = choice1
  tmp2 = choice2

  # PLSDA
  if(is.null(tmp2)) {
    # Simple level PLSDA mixOmics
    plsda = plsda(Data, Design[,tmp1], ncomp = 10, ...)
    p = plotIndiv(plsda , comp = 1:2,
                  group = Design[,tmp1], ind.names = FALSE,
                  ellipse = TRUE, legend = TRUE, title = paste("Simple PLSDA - ",tmp1, sep=""))
    return(p)
  }

  if(!is.null(tmp2)){
    # Multilevel PLSDA mixOmics
    plsda = plsda(Data, Design[,tmp1], ncomp = 10, multilevel = Design[,tmp2], ...)
    p = plotIndiv(plsda , comp = 1:2,
                  group = Design[,tmp1], ind.names = FALSE,
                  ellipse = TRUE, legend = TRUE,
                  title = paste("Multilevel PLSDA - ",tmp1," vs ", tmp2, sep="")
    )
    return(p)
  }
}

bvittrant/RCommon documentation built on May 4, 2020, 3:04 p.m.