Debian Codegraph @

man/tidy_irlba.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/list-irlba.R
3 \name{tidy_irlba}
4 \alias{tidy_irlba}
5 \alias{tidy.irlba}
6 \alias{irlba_tidiers}
7 \title{Tidy a(n) irlba object masquerading as list}
8 \usage{
9 tidy_irlba(x, ...)
10 }
11 \arguments{
12 \item{x}{A list returned from \code{\link[irlba:irlba]{irlba::irlba()}}.}
13
14 \item{...}{Additional arguments. Not used. Needed to match generic
15 signature only. \strong{Cautionary note:} Misspelled arguments will be
16 absorbed in \code{...}, where they will be ignored. If the misspelled
17 argument has a default value, the default value will be used.
18 For example, if you pass \code{conf.lvel = 0.9}, all computation will
19 proceed using \code{conf.level = 0.95}. Two exceptions here are:
20 \itemize{
21 \item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if
22 it will be ignored.
23 \item \code{augment()} methods will warn when supplied a \code{newdata} argument if it
24 will be ignored.
25 }}
26 }
27 \value{
28 A \link[tibble:tibble]{tibble::tibble} with columns depending on the component of
29 PCA being tidied.
30
31 If \code{matrix} is \code{"u"}, \code{"samples"}, \code{"scores"}, or \code{"x"} each row in the
32 tidied output corresponds to the original data in PCA space. The columns
33 are:
34
35 \item{\code{row}}{ID of the original observation (i.e. rowname from original
36 data).}
37 \item{\code{PC}}{Integer indicating a principal component.}
38 \item{\code{value}}{The score of the observation for that particular principal
39 component. That is, the location of the observation in PCA space.}
40
41 If \code{matrix} is \code{"v"}, \code{"rotation"}, \code{"loadings"} or \code{"variables"}, each
42 row in the tidied output corresponds to information about the principle
43 components in the original space. The columns are:
44
45 \item{\code{row}}{The variable labels (colnames) of the data set on
46 which PCA was performed.}
47 \item{\code{PC}}{An integer vector indicating the principal component.}
48 \item{\code{value}}{The value of the eigenvector (axis score) on the
49 indicated principal component.}
50
51 If \code{matrix} is \code{"d"}, \code{"eigenvalues"} or \code{"pcs"}, the columns are:
52
53 \item{\code{PC}}{An integer vector indicating the principal component.}
54 \item{\code{std.dev}}{Standard deviation explained by this PC.}
55 \item{\code{percent}}{Fraction of variation explained by this component
56 (a numeric value between 0 and 1).}
57 \item{\code{cumulative}}{Cumulative fraction of variation explained by
58 principle components up to this component (a numeric value between 0 and
59 1).}
60 }
61 \description{
62 Broom tidies a number of lists that are effectively S3
63 objects without a class attribute. For example, \code{\link[stats:optim]{stats::optim()}},
64 \link[base:svd]{svd()} and \code{\link[interp:interp]{interp::interp()}} produce consistent output, but
65 because they do not have a class attribute, they cannot be handled by S3
66 dispatch.
67
68 These functions look at the elements of a list and determine if there is
69 an appropriate tidying method to apply to the list. Those tidiers are
70 implemented as functions of the form \verb{tidy_<function>} or
71 \verb{glance_<function>} and are not exported (but they are documented!).
72
73 If no appropriate tidying method is found, they throw an error.
74 }
75 \details{
76 A very thin wrapper around \code{\link[=tidy_svd]{tidy_svd()}}.
77 }
78 \examples{
79 \dontshow{if (rlang::is_installed(c("modeldata", "ggplot2"))) withAutoprint(\{ # examplesIf}
80
81 library(modeldata)
82 data(hpc_data)
83
84 mat <- scale(as.matrix(hpc_data[, 2:5]))
85 s <- svd(mat)
86
87 tidy_u <- tidy(s, matrix = "u")
88 tidy_u
89
90 tidy_d <- tidy(s, matrix = "d")
91 tidy_d
92
93 tidy_v <- tidy(s, matrix = "v")
94 tidy_v
95
96 library(ggplot2)
97 library(dplyr)
98
99 ggplot(tidy_d, aes(PC, percent)) +
100 geom_point() +
101 ylab("\% of variance explained")
102
103 tidy_u |>
104 mutate(class = hpc_data$class[row]) |>
105 ggplot(aes(class, value)) +
106 geom_boxplot() +
107 facet_wrap(~PC, scale = "free_y")
108 \dontshow{\}) # examplesIf}
109 }
110 \seealso{
111 \code{\link[=tidy]{tidy()}}, \code{\link[irlba:irlba]{irlba::irlba()}}
112
113 Other list tidiers:
114 \code{\link{glance_optim}()},
115 \code{\link{list_tidiers}},
116 \code{\link{tidy_optim}()},
117 \code{\link{tidy_svd}()},
118 \code{\link{tidy_xyz}()}
119
120 Other svd tidiers:
121 \code{\link{augment.prcomp}()},
122 \code{\link{tidy.prcomp}()},
123 \code{\link{tidy_svd}()}
124 }
125 \concept{list tidiers}
126 \concept{svd tidiers}