1
0
mirror of https://github.com/msberends/AMR.git synced 2025-08-19 15:02:16 +02:00
Files
R
data
data-raw
docs
inst
man
figures
AMR-deprecated.Rd
AMR.Rd
WHOCC.Rd
WHONET.Rd
ab_property.Rd
age.Rd
age_groups.Rd
antibiotics.Rd
as.ab.Rd
as.atc.Rd
as.disk.Rd
as.mic.Rd
as.mo.Rd
as.rsi.Rd
atc_online.Rd
availability.Rd
catalogue_of_life.Rd
catalogue_of_life_version.Rd
count.Rd
eucast_rules.Rd
extended-functions.Rd
filter_ab_class.Rd
first_isolate.Rd
freq.Rd
g.test.Rd
ggplot_rsi.Rd
guess_ab_col.Rd
join.Rd
key_antibiotics.Rd
kurtosis.Rd
like.Rd
mdro.Rd
microorganisms.Rd
microorganisms.codes.Rd
microorganisms.old.Rd
mo_property.Rd
mo_source.Rd
p.symbol.Rd
portion.Rd
read.4D.Rd
resistance_predict.Rd
rsi_translation.Rd
septic_patients.Rd
skewness.Rd
translate.Rd
pkgdown
tests
vignettes
.Rbuildignore
.gitignore
.gitlab-ci.R
.gitlab-ci.yml
DESCRIPTION
LICENSE
NAMESPACE
NEWS.md
README.md
_pkgdown.yml
appveyor.yml
codecov.yml
git_commit.sh
git_merge.sh
git_premaster.sh
git_release.sh
git_siteonly.sh
index.md
AMR/man/age.Rd
2019-06-03 17:45:22 +02:00

40 lines
1.6 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/age.R
\name{age}
\alias{age}
\title{Age in years of individuals}
\usage{
age(x, reference = Sys.Date(), exact = FALSE)
}
\arguments{
\item{x}{date(s), will be coerced with \code{\link{as.POSIXlt}}}
\item{reference}{reference date(s) (defaults to today), will be coerced with \code{\link{as.POSIXlt}} and cannot be lower than \code{x}}
\item{exact}{a logical to indicate whether age calculation should be exact, i.e. with decimals. It divides the number of days of \href{https://en.wikipedia.org/wiki/Year-to-date}{year-to-date} (YTD) of \code{x} by the number of days in a year of \code{reference} (either 365 or 366).}
}
\value{
An integer (no decimals) if \code{exact = FALSE}, a double (with decimals) otherwise
}
\description{
Calculates age in years based on a reference date, which is the sytem date at default.
}
\section{Read more on our website!}{
On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a tutorial} about how to conduct AMR analysis, the \href{https://msberends.gitlab.io/AMR/reference}{complete documentation of all functions} (which reads a lot easier than here in R) and \href{https://msberends.gitlab.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}.
}
\examples{
# 10 random birth dates
df <- data.frame(birth_date = Sys.Date() - runif(10) * 25000)
# add ages
df$age <- age(df$birth_date)
# add exact ages
df$age_exact <- age(df$birth_date, exact = TRUE)
df
}
\seealso{
\code{\link{age_groups}} to split age into age groups
}