Debian Codegraph @

man/tidy.rcorr.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/hmisc.R
3 \name{tidy.rcorr}
4 \alias{tidy.rcorr}
5 \alias{rcorr_tidiers}
6 \alias{Hmisc_tidiers}
7 \title{Tidy a(n) rcorr object}
8 \usage{
9 \method{tidy}{rcorr}(x, diagonal = FALSE, ...)
10 }
11 \arguments{
12 \item{x}{An \code{rcorr} object returned from \code{\link[Hmisc:rcorr]{Hmisc::rcorr()}}.}
13
14 \item{diagonal}{Logical indicating whether or not to include diagonal
15 elements of the correlation matrix, or the correlation of a column with
16 itself. For the elements, \code{estimate} is always 1 and \code{p.value} is always
17 \code{NA}. Defaults to \code{FALSE}.}
18
19 \item{...}{Additional arguments. Not used. Needed to match generic
20 signature only. \strong{Cautionary note:} Misspelled arguments will be
21 absorbed in \code{...}, where they will be ignored. If the misspelled
22 argument has a default value, the default value will be used.
23 For example, if you pass \code{conf.lvel = 0.9}, all computation will
24 proceed using \code{conf.level = 0.95}. Two exceptions here are:
25 \itemize{
26 \item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if
27 it will be ignored.
28 \item \code{augment()} methods will warn when supplied a \code{newdata} argument if it
29 will be ignored.
30 }}
31 }
32 \description{
33 Tidy summarizes information about the components of a model.
34 A model component might be a single term in a regression, a single
35 hypothesis, a cluster, or a class. Exactly what tidy considers to be a
36 model component varies across models but is usually self-evident.
37 If a model has several distinct types of components, you will need to
38 specify which components to return.
39 }
40 \details{
41 Suppose the original data has columns A and B. In the correlation
42 matrix from \code{rcorr} there may be entries for both the \code{cor(A, B)} and
43 \code{cor(B, A)}. Only one of these pairs will ever be present in the tidy
44 output.
45 }
46 \examples{
47 \dontshow{if (FALSE) withAutoprint(\{ # examplesIf}
48
49 # load libraries for models and data
50 library(Hmisc)
51
52 mat <- replicate(52, rnorm(100))
53
54 # add some NAs
55 mat[sample(length(mat), 2000)] <- NA
56
57 # also, column names
58 colnames(mat) <- c(LETTERS, letters)
59
60 # fit model
61 rc <- rcorr(mat)
62
63 # summarize model fit with tidiers + visualization
64 td <- tidy(rc)
65 td
66
67 library(ggplot2)
68 ggplot(td, aes(p.value)) +
69 geom_histogram(binwidth = .1)
70
71 ggplot(td, aes(estimate, p.value)) +
72 geom_point() +
73 scale_y_log10()
74 \dontshow{\}) # examplesIf}
75 }
76 \seealso{
77 \code{\link[=tidy]{tidy()}}, \code{\link[Hmisc:rcorr]{Hmisc::rcorr()}}
78 }
79 \value{
80 A \code{\link[tibble:tibble]{tibble::tibble()}} with columns:
81 \item{column1}{Name or index of the first column being described.}
82 \item{column2}{Name or index of the second column being described.}
83 \item{estimate}{The estimated value of the regression term.}
84 \item{p.value}{The two-sided p-value associated with the observed statistic.}
85 \item{n}{Number of observations used to compute the correlation}
86
87 }