Skip to content

Commit

Permalink
General vectorisation for integer and numeric types
Browse files Browse the repository at this point in the history
  • Loading branch information
domjarkey committed Sep 20, 2022
1 parent 037c3b0 commit 281e4bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/codeBookGeneric.R
Original file line number Diff line number Diff line change
@@ -98,8 +98,8 @@ writeCodeBookLatexGeneric <- function(
x <- ds %>% filter(cd_number == 1) %>% dplyr::select(nm) %>% dplyr::collect() %>% dplyr::pull(nm)
} else {
x <- ds %>% dplyr::select(nm) %>% dplyr::collect() %>% dplyr::pull(nm)
if (cls == "integer") {
x <- as.integer(as.numeric(x))
if (cls %in% c("integer", "numeric")) {
x <- unlist(as.vector(x, mode = "list"))
}
if (cls == "factor") {
x <- factor(levels(x)[as.integer(x)], levels = levels(x))

0 comments on commit 281e4bc

Please sign in to comment.