Description Usage Arguments Details Value Methods (by class) See Also Examples
Import definition of several variables and create a DatabaseDef
object.
1 2 3 4 | import_vardef(vardf, col_replacement)
## S4 method for signature 'data.frame'
import_vardef(vardf, col_replacement)
|
vardf |
A |
col_replacement |
Replacement for the columns |
The col_replacement
parameter by default are :
c(rname = "rname",
varlabel = "varlabel",
description = "description",
type = "type",
commentary = "commentary",
flevel = "flevel",
flabel = "flabel")
.
It is possible to overwrite by passing c(key = "value")
in the colnames
parameter.
Return a DatabaseDef
object.
data.frame
:
To create a definition of variables table from a database, use /link{descvars_skeleton}
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # create a simple definition of variables table in a data.frame
testdf <- read.table(header = TRUE, stringsAsFactors=FALSE,
text="
rname varlabel description type flevel1 name1 flevel2 name2 flevel3 name3
id Identification 'Unique ID' integer NA NA NA NA NA NA
age 'Age of patient' NA integer NA NA NA NA NA NA
city 'City' 'City where live actually' factor 1 Strasbourg 2 Paris 3 London
weight 'Weight' 'Weight at the beginning of the study' numeric NA NA NA NA NA NA
")
# create the DatabaseDef object
import_vardef(testdf)
# When the headers are not standard, it's possible to pass a
# replacement dictionnary
names(testdf) <- c("variable", "etiquette", "description",
"type", "code1", "modalite1", "code2", "modalite2",
"code3", "modalite3")
head(testdf)
import_vardef(testdf,
col_replacement = c("rname" = "variable",
"varlabel" = "etiquette",
"flevel" = "code",
"flabel" = "modalite")
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.