mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-19 13:17:30 +02:00
Deploying to gh-pages from @ agdamsbo/REDCapCAST@db75c3313e 🚀
This commit is contained in:
parent
bc2e23a272
commit
0b30252598
171 changed files with 7009 additions and 602 deletions
37
reference/format_redcap_factor.md
Normal file
37
reference/format_redcap_factor.md
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# Converts REDCap choices to factor levels and stores in labels attribute
|
||||
|
||||
Applying
|
||||
[as_factor](https://agdamsbo.github.io/REDCapCAST/reference/as_factor.md)
|
||||
to the data.frame or variable, will coerce to a factor.
|
||||
|
||||
## Usage
|
||||
|
||||
``` r
|
||||
format_redcap_factor(data, meta)
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
- data:
|
||||
|
||||
vector
|
||||
|
||||
- meta:
|
||||
|
||||
vector of REDCap choices
|
||||
|
||||
## Value
|
||||
|
||||
vector of class "labelled" with a "labels" attribute
|
||||
|
||||
## Examples
|
||||
|
||||
``` r
|
||||
format_redcap_factor(sample(1:3, 20, TRUE), "1, First. | 2, second | 3, THIRD")
|
||||
#> [1] 3 3 3 3 2 3 3 3 2 3 2 2 1 1 2 2 1 1 3 1
|
||||
#> attr(,"labels")
|
||||
#> First. second THIRD
|
||||
#> "1" "2" "3"
|
||||
#> attr(,"class")
|
||||
#> [1] "labelled"
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue