ropensci / writexl

Portable, light-weight data frame to xlsx exporter for R
https://docs.ropensci.org/writexl
Other
210 stars 17 forks source link

Feature: write a list of data frames #3

Closed jbkunst closed 7 years ago

jbkunst commented 7 years ago

I really like the openxlsx feature when you use a list of data frame as argument:

openxlsx::write.xlsx(list(ir = iris, cars = mtcars), "asdf.xlsx")

This code creates a workbook with 2 sheets with the respective names (ir and cars).

Thanks again for all your work!

jeroen commented 7 years ago

I have added this to the development version. Can you test this?

devtools::install_github("ropensci/writexl")

Syntax is the same as for openxlsx:

writexl::write_xlsx(list(ir = iris, cars = mtcars), "mydata.xlsx")
jbkunst commented 7 years ago

I tested (on windows machines 😅 ) it and works like it should. Thanks.

jeroen commented 7 years ago

OK thanks!

jeroen commented 7 years ago

This is on CRAN now.

BruceZhaoR commented 7 years ago

Awesome! BTW, how about merging readxl & writexl into one package?

sillasgonzaga commented 6 years ago

please update the documentation about this resource

jameshowison commented 6 years ago

This is wonderful. Thanks. It works really well with deframe from the tidyverse (tibble specifically), e.g.:

library(tidyverse)
data(iris)
iris %>% 
  group_by(Species) %>% 
  nest() %>% 
  deframe() %>% 
  write_xlsx("iris_tab_per_species.xlsx")
enricoferrero commented 6 years ago

Fantastic, thanks! It's probably worth to add to the write_xlsx() help page that x can be a data frame or a list of data frames.

jeroen commented 6 years ago

Can you send a pr for that?

enricoferrero commented 6 years ago

Just checked and it's actually already in there, sorry!

\item{x}{data frame or named list of data frames that will be sheets in the xlsx}

The version on CRAN has the functionality but the docs are not up-to-date.