Skip to content

Interrogates the rotation in each dimension defined by dims and orders the features by the value of the principal components in that dimension. Each dimension is represented by a column of the resulting data frame.

Usage

get_top_pca_rotation(x, dims = 1:5L, n = 30L)

Arguments

x

A pca class object.

dims

integer(n). Vector of which dimensions to interrogate.

n

integer(1). The limit on how many features to report (i.e. the rows of the resulting data frame).

Value

A data frame of the top features ordered by the principal components given in the selected dimension.

Author

Stu Field, Michael R. Mehan

Examples

pca <- pca(pcapkg:::log10_ft(simdata))
get_top_pca_rotation(pca, n = 10L)
#> # A tibble: 10 × 5
#>    PC1   PC2   PC3   PC4   PC5  
#>    <chr> <chr> <chr> <chr> <chr>
#>  1 7     5     8     36    31   
#>  2 9     33    37    37    19   
#>  3 10    23    14    32    14   
#>  4 15    4     27    39    40   
#>  5 6     22    38    3     21   
#>  6 19    3     28    28    33   
#>  7 37    13    20    21    22   
#>  8 29    30    18    6     9    
#>  9 5     18    25    24    1    
#> 10 22    35    4     33    11