mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-21 05:59:07 +02:00
added option to export "both" raw and label by labelling raw data to preserve as much information as possible
This commit is contained in:
parent
57f9f23ece
commit
2ba46e8e7a
11 changed files with 177 additions and 230 deletions
|
|
@ -8,6 +8,8 @@
|
|||
\alias{as_factor.character}
|
||||
\alias{as_factor.haven_labelled}
|
||||
\alias{as_factor.labelled}
|
||||
\alias{as_factor.redcapcast_labelled}
|
||||
\alias{as_factor.data.frame}
|
||||
\title{Convert labelled vectors to factors while preserving attributes}
|
||||
\usage{
|
||||
as_factor(x, ...)
|
||||
|
|
@ -33,6 +35,15 @@ as_factor(x, ...)
|
|||
ordered = FALSE,
|
||||
...
|
||||
)
|
||||
|
||||
\method{as_factor}{redcapcast_labelled}(
|
||||
x,
|
||||
levels = c("default", "labels", "values", "both"),
|
||||
ordered = FALSE,
|
||||
...
|
||||
)
|
||||
|
||||
\method{as_factor}{data.frame}(x, ..., only_labelled = TRUE)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{Object to coerce to a factor.}
|
||||
|
|
@ -49,6 +60,8 @@ as_factor(x, ...)
|
|||
|
||||
\item{ordered}{If `TRUE` create an ordered (ordinal) factor, if
|
||||
`FALSE` (the default) create a regular (nominal) factor.}
|
||||
|
||||
\item{only_labelled}{Only apply to labelled columns?}
|
||||
}
|
||||
\description{
|
||||
This extends [forcats::as_factor()] as well as [haven::as_factor()], by appending
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue