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

save_to_excel not allowing lists #153

Closed
alcrosby opened this issue Mar 2, 2023 · 1 comment
Closed

save_to_excel not allowing lists #153

alcrosby opened this issue Mar 2, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@alcrosby
Copy link

alcrosby commented Mar 2, 2023

save_to_excel() is not accepting lists, such as generated by named_item_list().

Changing
if (!is.data.frame(.data))
to
if (is.data.frame(.data) | is.list(.data))
would be a partial solution, but wouldn't guarantee that the list is a named list of data frames that could be used by writexl::write_xlsx()

adding another if statement like
if (is.list(.data) & !all(unlist(map(.data,is.data.frame)))) { stop(call. = FALSE, "(.data) is a list, but is not a list of data.frames/tibbles. Please supply a valid list") }
would at least check to ensure that each element of .data is a data.frame/tibble. Might still need to check to see if they are named...

BTW, that's a cool trick and feature of write_xlsx() that i'd missed...

@spsanderson
Copy link
Owner

spsanderson commented Mar 2, 2023 via email

@spsanderson spsanderson self-assigned this Mar 2, 2023
@spsanderson spsanderson added the bug Something isn't working label Mar 2, 2023
@spsanderson spsanderson added this to the healthyR 0.2.1 milestone Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants