cannot group multiple rows in pivot table
bradSchrage opened this issue · 1 comments
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)
)
`
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.