-
Notifications
You must be signed in to change notification settings - Fork 1
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
List of dataframes bound to a name produces empty worksheet #37
Comments
Thanks @JulienBlasco > datasets |> toxlsx(path = mypath, tosheet = list("iris" ="iris", "cars" = "cars" , "mtcars" = "mtcars"))
Error in listsplitted[[tosheet[[df_name]]]] :
attempt to select less than one element in get1index |
Yes indeed, @teorems' example still doesn't work. But the problem is that once the datasets <- list(iris, cars, mtcars)
datasets
#> [[1]]
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.2 setosa
#> 2 4.9 3.0 1.4 0.2 setosa
#> 3 4.7 3.2 1.3 0.2 setosa
#> 4 4.6 3.1 1.5 0.2 setosa
#> 5 5.0 3.6 1.4 0.2 setosa
#> 6 5.4 3.9 1.7 0.4 setosa
#> ...
#>
#> [[2]]
#> speed dist
#> 1 4 2
#> 2 4 10
#> 3 7 4
#> 4 7 22
#> 5 8 16
#> 6 9 10
#> ...
#>
#> [[3]]
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
#> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
#> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1
#> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1
#> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
#> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1
#> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4
#> ... Therefore, when Two possible solutions are now provided by the latest version of the package (which is that of commit 89511db as I write these lines) 1. Name the elements of
|
Thanks @JulienBlasco ! Indeed, both solutions work. While I'm waiting for @teorems' answer, I'll keep this issue in mind and possibly think about documenting it in the vignette... |
Kudos for this package. Handy idea, mostly for the automatic sheet creation as it avoids to use something like map or lapply and a custom function with various openxlsx function calls ...
However I encounter this issue :
Exporting a list() of dataframes, like list(iris, cars etc.) is fine.
But when the list is bound to a name like datasets <- list(iris, cars, mtcars) the resulting workbook is created but empty (argument tosheet = specified or not).
Created on 2024-06-06 with reprex v2.1.0
Session info
Cheers.
The text was updated successfully, but these errors were encountered: