我正在尝试获取分组 BigQuery 表中变量的分位数,但出现此错误:
Error: Job 'xxxxx' failed
Syntax error: Expected end of input but got keyword WITHIN at [1:45] [invalidQuery]
代表如下。
# NOTE: for reprex to work, you must have BIGQUERY_TEST_PROJECT envvar set to name of project which has billing set up and to which you have write access
library(DBI)
library(bigrquery)
library(dplyr)
billing <- bq_test_project()
con <- dbConnect(
bigrquery::bigquery(),
project = "publicdata",
dataset = "samples",
billing = billing
)
natality <- tbl(con, "natality")
natality %>%
group_by(year) %>%
summarize(q25 = quantile(weight_pounds,0.25),
q50 = median(weight_pounds),
q75 = quantile(weight_pounds,0.75)
)
任何人都知道一种解决方法,也许是通过sql()
在summarise()
调用中提供 SQL 代码?
谢谢!