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

cannot group multiple rows in pivot table #193

Open
bradSchrage opened this issue Feb 18, 2021 · 1 comment
Open

cannot group multiple rows in pivot table #193

bradSchrage opened this issue Feb 18, 2021 · 1 comment
Labels

Comments

@bradSchrage
Copy link

bradSchrage commented Feb 18, 2021

Hi Matt,

I'm one of your students and love your work. I am trying to convince people on my team to move away from Excel and love the idea of porting Excel Functions to R to get people going. However, pivot_table seems to throw an error that rows don't exist if they are raw rows> 1.

From your example,

`
library(tidyquant)
library(tidyverse)
library(lubridate)

this works

FANG %>%
pivot_table(
.rows = c(symbol, ~ QUARTER(date)),
.columns = ~ YEAR(date),
.values = ~ PCT_CHANGE_FIRSTLAST(adjusted)
)

this does as well....

FANG %>%
pivot_table(
.rows = c(symbol, ~ymd(date)),
.columns = ~ YEAR(date),
.values = ~ PCT_CHANGE_FIRSTLAST(adjusted)
)

this doesn't. Do row arguments > 2 need a function to work?

FANG %>%
pivot_table(
.rows = c(symbol, date),
.columns = ~ YEAR(date),
.values = ~ PCT_CHANGE_FIRSTLAST(adjusted)
)

`

@mdancho84
Copy link
Collaborator

I need to do some rework on this function. It's not working properly. Will be doing a big update for the next tq release.

@mdancho84 mdancho84 added the bug label Feb 27, 2021
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