【发布时间】:2019-09-12 08:11:15
【问题描述】:
当我在远程 Postgres 数据库上尝试一些代码时,我收到以下错误消息。
以下 peusdo 复制代码在数据帧是本地的时运行良好,但在远程时则不行。
library(tidyverse)
library(dbplyr)
library(RPostgres)
event <- tibble(id = c("00_1", "00_2", "00_3", "00_4", "00_5", "00_6", "00_7"),
type_id = c("A", "B", "C", "B", "A", "B", "C"))
detail <- tibble(id = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L),
event_id = c("00_1", "00_1", "00_2", "00_2", "00_3", "00_4", "00_4", "00_5", "00_6", "00_6", "00_7", "00_8"),
type_id = c(3L, 4L, 6L, 7L, 2L, 6L, 3L, 2L, 6L, 5L, 2L, 1L))
event_f <- event %>%
mutate(new_variable = id %in% (detail %>%
filter(type_id == 6) %>%
pull(event_id))) %>%
collect()
Error in UseMethod("escape") : no applicable method for 'escape' applied to an object of class "c('tbl_PqConnection', 'tbl_dbi', 'tbl_sql', 'tbl_lazy', 'tbl')"
【问题讨论】:
-
您真的在使用名为
Rpostgres的包吗? CRAN 上的那个叫RPostgres。当我使用它时,我没有收到任何错误。 -
抱歉,这是 RPostgres。您是否尝试使用
event和detail的远程数据帧重现上述示例?因为当它在本地时,它确实效果很好。 -
不,我使用了您发布的示例。