Skip to contents

Multidimensional scaling of random forest proximities.

Usage

mds(x, dimensions = 2, idx = NULL)

# S4 method for RandomForest
mds(x, dimensions = 2, idx = NULL)

# S4 method for list
mds(x, dimensions = 2, idx = NULL)

# S4 method for Analysis
mds(x, dimensions = 2, idx = NULL)

Arguments

x

S4 object of class RandomForest, Analysis or a list

dimensions

The number of dimensions by which the data are to be represented.

idx

sample information column to use for sample names. If NULL, the sample row number will be used. Sample names should be unique for each row of data.

Value

A tibble containing the scaled dimensions.

Examples

library(metaboData)

x <- analysisData(abr1$neg[,200:300],abr1$fact) %>%
       occupancyMaximum(cls = 'day') %>%
       transformTICnorm()
       
rf <- randomForest(x,cls = 'day')

mds(rf)
#> # A tibble: 120 × 5
#>    response comparison  sample `dimension 1` `dimension 2`
#>    <chr>    <chr>        <dbl>         <dbl>         <dbl>
#>  1 day      1~2~3~4~5~H      1       -0.0129       -0.190 
#>  2 day      1~2~3~4~5~H      2       -0.101        -0.254 
#>  3 day      1~2~3~4~5~H      3       -0.0156        0.173 
#>  4 day      1~2~3~4~5~H      4       -0.0896        0.147 
#>  5 day      1~2~3~4~5~H      5        0.146        -0.0566
#>  6 day      1~2~3~4~5~H      6       -0.132         0.0946
#>  7 day      1~2~3~4~5~H      7       -0.0862       -0.195 
#>  8 day      1~2~3~4~5~H      8        0.144        -0.0917
#>  9 day      1~2~3~4~5~H      9        0.0408       -0.110 
#> 10 day      1~2~3~4~5~H     10       -0.146         0.155 
#> # ℹ 110 more rows