sc_recoder | R Documentation |
A collection of methods that can be used to modify an object of class
sc_table by reference. Typical usage is to access the recode
binding
of an sc_table
object and then use method chaining to perform recode
operations.
x <- od_table("OGD_krebs_ext_KREBS_1") x$recode$ label_field("C-BERJ-0", "de", "JAHR")$ label_measure("F-KRE", "de", "Anzahl")
See the example section for more details.
new()
Create a new recoder instance. This will automatically
be performed during the setup of sc_data
objects
sc_recoder$new(x)
x
the private environment of an sc_data
object
label_field()
Change the label of a field variable
sc_recoder$label_field(field, language, new)
field
a field code
language
a language, "de" or "en"
new
the new label
label_measure()
Change the label of a measure variable
sc_recoder$label_measure(measure, language, new)
measure
a measure code
language
a language "de" or "en"
new
the new label
level()
Change the labels of a level
sc_recoder$level(field, level, language, new)
field
a field code
level
a level code for the field
language
a language "de" or "en"
new
the new label for the level
total_codes()
Change the total code for a field
sc_recoder$total_codes(field, new)
field
a field code
new
a level code for the field or NA
. Will be used as the
new total code. In case of NA
, the total code will be unset.
visible()
set the visibility of a level. Invisible levels are
omitted in the output of $tabulate()
but don't affect aggregation
sc_recoder$visible(field, level, new)
field
a field code
level
a level code for the field
new
visibility. TRUE
or FALSE
order()
set the order of levels.
sc_recoder$order(field, new)
field
a field code
new
the new order. A permutation of all level codes for the field. alternatively, an integer vector that defines the permutation.
x <- od_table("OGD_krebs_ext_KREBS_1")
x$recode$
label_field("C-KRE_GESCHLECHT-0", "en", "SEX")$
label_measure("F-KRE", "en", "NUMBER")$
level("C-KRE_GESCHLECHT-0", "GESCHLECHT-1", "en", "MALE")
x$tabulate("C-KRE_GESCHLECHT-0", "F-KRE")
earnings <- od_table("OGD_veste309_Veste309_1")
earnings$recode$
total_codes("C-A11-0", "A11-1")$
total_codes("C-STAATS-0", "STAATS-9")$
total_codes("C-VEBDL-0", "VEBDL-10")$
total_codes("C-BESCHV-0", "BESCHV-1")
earnings$total_codes()
earnings$tabulate("C-STAATS-0")
earnings$recode$visible("C-STAATS-0", "STAATS-8", FALSE)
earnings$tabulate("C-STAATS-0")
earnings$recode$
order("C-A11-0", c("A11-3", "A11-1", "A11-2"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.