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

split_into_pages_by_var() ignores factor levels #234

Closed
Melkiades opened this issue Nov 22, 2024 · 0 comments · Fixed by #235
Closed

split_into_pages_by_var() ignores factor levels #234

Melkiades opened this issue Nov 22, 2024 · 0 comments · Fixed by #235
Assignees
Labels
bug Something isn't working sme

Comments

@Melkiades
Copy link
Contributor

From internal user @jasmina_u; proposed fix:

split_into_pages_by_var_custom <- function(lsting, var, page_prefix = var) {

  lsting_by_var <- list()
  for (lvl in levels(lsting[[var]])) {
    if(lvl %in% unique(lsting[[var]])) {
      var_desc <- paste0(page_prefix, ": ", lvl)
      lsting_by_var[[lvl]] <- lsting[lsting[[var]] == lvl, ]
      subtitles(lsting_by_var[[lvl]]) <- c(subtitles(lsting), var_desc)
    }
  }

  lsting_by_var
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant