Description Usage Arguments Value Examples
add layer to current composition
1 2 3 4 5 6 7 | compose(.data, source, to, where.selected.any = NULL,
where.selected.all = NULL, where.selected.exactly = NULL,
where.selected.none = NULL, where.num.equal = NULL,
where.num.smaller = NULL, where.num.smaller.equal = NULL,
where.num.larger = NULL, where.num.larger.equal = NULL,
where.string = NULL, otherwise.to = NA, skipped.to = NA,
na.to = NA, questionnaire = NULL)
|
.data |
the composition, see new_composition() |
source |
the name of the source variable to compose from |
to |
the value to set the new composition to if the condition is fulfilled |
where.selected.. |
: a vector of choices; setting values to 'to' where in the source variable any/all/exactly/none of the supplied choices had been selected |
where.num... |
: a scalar number. setting values to 'to' where the 'source' is equal / smaller / smaller or equal / larger / larger or euqal than the number supplied in where.num... |
otherwise |
an alternative value to be used if the condition is not fulfilled, the source is not NA and not skipped |
the updated composition
1 2 3 4 5 6 7 | df<-data.frame(a=1:100,b=sample(letters[1:5],100,T))
df %>% new_composition("new_variable_name") %>%
compose("a",to = "less than 50" ,where.num.smaller = 50) %>%
compose("a",to = "more or equal 50", where.num.larger.equal = 50)
compose("b",to = "(size not important)",where.selected.exactly = "d") %>%
end_composition()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.