| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/survival-pyears.R |
| 3 |
\name{tidy.pyears} |
| 4 |
\alias{tidy.pyears} |
| 5 |
\alias{pyears_tidiers} |
| 6 |
\title{Tidy a(n) pyears object} |
| 7 |
\usage{ |
| 8 |
\method{tidy}{pyears}(x, ...) |
| 9 |
} |
| 10 |
\arguments{ |
| 11 |
\item{x}{A \code{pyears} object returned from \code{\link[survival:pyears]{survival::pyears()}}.} |
| 12 |
|
| 13 |
\item{...}{Additional arguments. Not used. Needed to match generic |
| 14 |
signature only. \strong{Cautionary note:} Misspelled arguments will be |
| 15 |
absorbed in \code{...}, where they will be ignored. If the misspelled |
| 16 |
argument has a default value, the default value will be used. |
| 17 |
For example, if you pass \code{conf.lvel = 0.9}, all computation will |
| 18 |
proceed using \code{conf.level = 0.95}. Two exceptions here are: |
| 19 |
\itemize{ |
| 20 |
\item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if |
| 21 |
it will be ignored. |
| 22 |
\item \code{augment()} methods will warn when supplied a \code{newdata} argument if it |
| 23 |
will be ignored. |
| 24 |
}} |
| 25 |
} |
| 26 |
\description{ |
| 27 |
Tidy summarizes information about the components of a model. |
| 28 |
A model component might be a single term in a regression, a single |
| 29 |
hypothesis, a cluster, or a class. Exactly what tidy considers to be a |
| 30 |
model component varies across models but is usually self-evident. |
| 31 |
If a model has several distinct types of components, you will need to |
| 32 |
specify which components to return. |
| 33 |
} |
| 34 |
\details{ |
| 35 |
\code{expected} is only present in the output when if a \code{ratetable} |
| 36 |
term is present. |
| 37 |
|
| 38 |
If the \code{data.frame = TRUE} argument is supplied to \code{pyears}, |
| 39 |
this is simply the contents of \code{x$data}. |
| 40 |
} |
| 41 |
\examples{ |
| 42 |
\dontshow{if (rlang::is_installed("survival")) withAutoprint(\{ # examplesIf} |
| 43 |
|
| 44 |
# load libraries for models and data |
| 45 |
library(survival) |
| 46 |
|
| 47 |
# generate and format data |
| 48 |
temp.yr <- tcut(mgus$dxyr, 55:92, labels = as.character(55:91)) |
| 49 |
temp.age <- tcut(mgus$age, 34:101, labels = as.character(34:100)) |
| 50 |
ptime <- ifelse(is.na(mgus$pctime), mgus$futime, mgus$pctime) |
| 51 |
pstat <- ifelse(is.na(mgus$pctime), 0, 1) |
| 52 |
pfit <- pyears(Surv(ptime / 365.25, pstat) ~ temp.yr + temp.age + sex, mgus, |
| 53 |
data.frame = TRUE |
| 54 |
) |
| 55 |
|
| 56 |
# summarize model fit with tidiers |
| 57 |
tidy(pfit) |
| 58 |
glance(pfit) |
| 59 |
|
| 60 |
# if data.frame argument is not given, different information is present in |
| 61 |
# output |
| 62 |
pfit2 <- pyears(Surv(ptime / 365.25, pstat) ~ temp.yr + temp.age + sex, mgus) |
| 63 |
|
| 64 |
tidy(pfit2) |
| 65 |
glance(pfit2) |
| 66 |
\dontshow{\}) # examplesIf} |
| 67 |
} |
| 68 |
\seealso{ |
| 69 |
\code{\link[=tidy]{tidy()}}, \code{\link[survival:pyears]{survival::pyears()}} |
| 70 |
|
| 71 |
Other pyears tidiers: |
| 72 |
\code{\link{glance.pyears}()} |
| 73 |
|
| 74 |
Other survival tidiers: |
| 75 |
\code{\link{augment.coxph}()}, |
| 76 |
\code{\link{augment.survreg}()}, |
| 77 |
\code{\link{glance.aareg}()}, |
| 78 |
\code{\link{glance.cch}()}, |
| 79 |
\code{\link{glance.coxph}()}, |
| 80 |
\code{\link{glance.pyears}()}, |
| 81 |
\code{\link{glance.survdiff}()}, |
| 82 |
\code{\link{glance.survexp}()}, |
| 83 |
\code{\link{glance.survfit}()}, |
| 84 |
\code{\link{glance.survreg}()}, |
| 85 |
\code{\link{tidy.aareg}()}, |
| 86 |
\code{\link{tidy.cch}()}, |
| 87 |
\code{\link{tidy.coxph}()}, |
| 88 |
\code{\link{tidy.survdiff}()}, |
| 89 |
\code{\link{tidy.survexp}()}, |
| 90 |
\code{\link{tidy.survfit}()}, |
| 91 |
\code{\link{tidy.survreg}()} |
| 92 |
} |
| 93 |
\concept{pyears tidiers} |
| 94 |
\concept{survival tidiers} |
| 95 |
\value{ |
| 96 |
A \code{\link[tibble:tibble]{tibble::tibble()}} with columns: |
| 97 |
\item{expected}{Expected number of events.} |
| 98 |
\item{pyears}{Person-years of exposure.} |
| 99 |
\item{n}{number of subjects contributing time} |
| 100 |
\item{event}{observed number of events} |
| 101 |
|
| 102 |
} |