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

enhancement request: pass list to set_values #189

Closed
jonathan-g opened this issue Mar 7, 2017 · 3 comments
Closed

enhancement request: pass list to set_values #189

jonathan-g opened this issue Mar 7, 2017 · 3 comments
Labels
feature a feature request or enhancement form 🧾

Comments

@jonathan-g
Copy link

I am dealing with automating scraping from a form that has lots of checkboxes that I want to programmatically set.

Right now I'm doing

vals <- list(form = f)
vals[list_of_boxes_to_check] <- 'on'
f <- do.call(set_values, vals)

It would be nice to have a trailing-underscore variant set_values_, like the corresponding functions in dplyr with which I could do

vals <- set_names(rep('on', length(list_of_boxes_to_check)), list_of_boxes_to_check)
f <- set_values_(f, .dots = vals)

If there is not a reason why this would be a bad idea, I can implement it and submit a pull-request.

@sdanielzafar
Copy link

+1 for this feature but would be nice to keep the same function handle, just recognize if a list is input then apply it. Can also help with pull request if needed.

@sdanielzafar
Copy link

sdanielzafar commented Mar 11, 2018

For anyone else with this issue, I've constructed a little wrapper for set_values that takes a list as input using do.call:

set_vals_batch <- function(form, .l) {
  do.call(function(...) {
    set_values(form, ...)
    }, .l)
}

@hadley hadley added the feature a feature request or enhancement label Mar 17, 2019
@hadley
Copy link
Member

hadley commented Mar 17, 2019

This will likely be solved by switching from list() to list2() so you can do set_values(form, !!!vals)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement form 🧾
Projects
None yet
Development

No branches or pull requests

3 participants