Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow recoding of sc_data objects #18

Merged
merged 22 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d1cfbe2
initial version of recoder
GregorDeCillia Aug 19, 2021
97414a1
add get/set methods for sc_table language
GregorDeCillia Aug 19, 2021
6ac8c30
add columns label_de and label_en to sc_table metadata
GregorDeCillia Aug 19, 2021
7d7e75f
od_table: fallback to german names in constructor
GregorDeCillia Aug 19, 2021
c810dbe
use language dynamically in $meta, $field(i)
GregorDeCillia Aug 19, 2021
5028614
match german and english name in $field() and $toal_codes()
GregorDeCillia Aug 19, 2021
13a051b
allow to set toal codes via recoder
GregorDeCillia Aug 19, 2021
d15c61c
remove language logic in od_table
GregorDeCillia Aug 19, 2021
ae59b21
update docs for ?sc_recoder
GregorDeCillia Aug 19, 2021
50d60d7
allow recoding of visibility
GregorDeCillia Aug 19, 2021
1d62a43
allow reordering of levels
GregorDeCillia Aug 19, 2021
4175326
version -> 0.2.5
GregorDeCillia Aug 25, 2021
999980b
$add_language() for sc_table
GregorDeCillia Aug 30, 2021
3190b28
document new method
GregorDeCillia Aug 30, 2021
ff5d763
add language option "both" for sc_table
GregorDeCillia Aug 30, 2021
db0e914
reroute @inheritParams
GregorDeCillia Aug 30, 2021
58f290e
devtools::document()
GregorDeCillia Aug 30, 2021
4465e7f
version -> 0.2.6
GregorDeCillia Aug 30, 2021
998410b
add language param to `$tabulate()`
GregorDeCillia Aug 30, 2021
02554b5
fixes for language param in tabulate
GregorDeCillia Aug 30, 2021
7c1d8de
add time type: week
GregorDeCillia Aug 31, 2021
fe38788
version -> 0.2.7
GregorDeCillia Aug 31, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
allow to set toal codes via recoder
  • Loading branch information
GregorDeCillia committed Aug 19, 2021
commit 13a051b2c3781698e53b5eecee4241941e10d35d
20 changes: 19 additions & 1 deletion R/recoder.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@
#' label_measure("F-KRE", "en", "NUMBER")$
#' level("C-KRE_GESCHLECHT-0", "GESCHLECHT-1", "en", "MALE")
#'
#' x$language <- "en"
#' 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()
sc_recoder <- R6::R6Class(
cloneable = FALSE,
"sc_recoder",
Expand Down Expand Up @@ -64,6 +72,16 @@ sc_recoder <- R6::R6Class(
stopifnot(!is.na(j))
private$x$p_fields[[i]][j, private$l(language)] <- new
invisible(self)
},
#' @description Cheange the total code for a field
#' @param field a field code
#' @param level a level code for the field
#' @param new the new total code
total_codes = function(field, level, new) {
i <- private$match_index(field, "fields")
stopifnot(is.na(level) || level %in% private$x$p_fields[[i]]$code)
private$x$p_meta$fields$total_code[i] <- level
invisible(self)
}
),
list(
Expand Down
32 changes: 31 additions & 1 deletion man/sc_recoder.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.