Description Usage Arguments Value Examples
Returns a tidy dataframe from a ox_all
object, containing data for all
items of the specified group
. In the resulting dataframe, each item is
a variable, and each row is an observation; dataframe variables are
identified by their item_oid
(or optionally, by their item_name
),
and are one of the following classes: Date
, numeric
, or
character
. Optionally, items with codelists can be defined as
factor
.
1 2 | ox_xtract_group(ox_obj, group, define_factors = FALSE,
use_item_names = FALSE)
|
ox_obj |
An object of class |
group |
A group of items, as |
define_factors |
A |
use_item_names |
A |
A dataframe with study, subject, event, form, group and group repeat keys,
plus all items in group
as variables.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # The example odm1.3 xml file address
my_file <- system.file("extdata",
"odm1.3_full_example.xml",
package = "ox",
mustWork = TRUE)
# Parsing the xml file
library(XML)
doc <- xmlParse(my_file)
# Create ox_all object
my_study <- ox_all(doc)
# Item groups
unique(my_study$metadata$group_def$group_oid)
# Extract data for a group
demo <- ox_xtract_group(my_study,
group = "IG_DEMO_DEMOGRAPHICDATA")
head(demo)
# Same, using item names to identify vars, and
# defining factors for items with codelist
demo_2 <- ox_xtract_group(my_study,
group = "IG_DEMO_DEMOGRAPHICDATA",
define_factors = TRUE,
use_item_names = TRUE)
head(demo_2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.