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

Error with asDataFrame() when rows = NULL #30

Closed
ismailmuller opened this issue Mar 27, 2020 · 3 comments
Closed

Error with asDataFrame() when rows = NULL #30

ismailmuller opened this issue Mar 27, 2020 · 3 comments
Labels

Comments

@ismailmuller
Copy link

I think there might be a bug when using $asDataFrame() on pivottable with NULL rows.
I don't know if it comes from actually first using qpvt() but here the code is below.

library(pivottabler)

X <- qpvt(iris, NULL, "Species", "mean(Sepal.Length)")
X$asDataFrame()
#> Error in grps[[c]]: attempt to select less than one element in integerOneIndex

X <- qpvt(iris, "Species", "Species", "mean(Sepal.Length)")
X$asDataFrame()
#>            setosa versicolor virginica    Total
#> setosa      5.006         NA        NA 5.006000
#> versicolor     NA      5.936        NA 5.936000
#> virginica      NA         NA     6.588 6.588000
#> Total       5.006      5.936     6.588 5.843333

X <- qpvt(iris, "Species", NULL, "mean(Sepal.Length)")
X$asDataFrame()
#>            calc000001
#> setosa       5.006000
#> versicolor   5.936000
#> virginica    6.588000
#> Total        5.843333

Created on 2020-03-27 by the reprex package (v0.3.0)

PS: thank you very much for this package. Actually the best I've used so far for pivot table in R

@cbailiss
Copy link
Owner

Thanks for reporting this. Definitely a bug.
I will release a fix in 3-5 days time.

@cbailiss cbailiss added the bug label Mar 28, 2020
@cbailiss
Copy link
Owner

A fix for this has been created, tested and merged into the master branch.
It will be released to CRAN in a couple of days.

@cbailiss
Copy link
Owner

cbailiss commented Apr 2, 2020

This has been fixed in v1.3.1 that was released to CRAN yesterday.

@cbailiss cbailiss closed this as completed Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants