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

Create a convenience function for printing out multiple calls to cb_add_col_attributes #34

Open
1 task
mbcann01 opened this issue Aug 13, 2022 · 0 comments
Labels
enhancement New feature or functionality

Comments

@mbcann01
Copy link
Member

Overview

This function works, just need to wrap it up

purrr::walk(
  .x = select(motivate, starts_with("arth")) %>% names(),
  .f = ~ cat(paste0('
    cb_add_col_attributes( \n    ',
      "  ", .x, ', \n    ',
      "  ", 'description = ""
    ) %>%
  '))
)

I want to be able to pass tidy select directly to the function and the attributes that I want to add a value for. It may also be cool to be able to provide a default value for each attribute.

# Work on the name
cb_generate_add_col_attributes(
  .cols  = select(motivate, starts_with("arth")),
  .attrs = list(
    source = "Arthritis Self-Efficacy",
    value_labels = c("Very Uncertain" = 1, "Very certain" = 10)
  )
)

But instead of printing out code, why not just make this add the attributes?

This need to be a separate issue (just writing it here before I forget), but I may also want quick add functions for each of the five special attributes.

cb_add_source(select(motivate, starts_with("arth")), "Arthritis Self-Efficacy"))

Left off

Haven't started yet

Task list

  • Item
@mbcann01 mbcann01 added the enhancement New feature or functionality label Aug 13, 2022
@mbcann01 mbcann01 moved this to Todo in codebookr Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or functionality
Projects
Status: Develop Next
Development

No branches or pull requests

1 participant