我想在bigrquery中使用dplyr语法在大查询中获得列的20%,但我不断遇到以下错误。这是一个可重现的示例:
library(bigrquery)
library(dplyr)
library(DBI)
billing <- YOUR_BILLING_INFO
con <- dbConnect(
bigrquery::bigquery(),
project = "publicdata",
dataset = "samples",
billing = billing
)
natality <- tbl(con, "natality")
natality %>%
filter(year %in% c(1969, 1970)) %>%
group_by(year) %>%
summarise(percentile_20 = percentile_cont(weight_pounds, 0.2))
我收到以下错误:
Error: Analytic function PERCENTILE_CONT cannot be called without an OVER clause at [1:16] [invalidQuery]
但是,目前尚不清楚如何在此处包括OVER子句。如何使用dplyr语法获得第20个百分位数?