Error: Invalid First Argument

4.2k views Asked by At

I'm getting an "invalid first argument" error for the following. However, con is an actual connection and is set up properly. So what does this error actually refer to?

library(dplyr)
con <- RSQLServer::src_sqlserver("***", database = "***")

myData <- con %>%
  tbl("table") %>%
  group_by( work_dt, campaign, ad_group, matchtype, keyword ) %>%
  select( work_dt, campaign, ad_group, matchtype, keyword, impressions, clicks, cost ) %>%
  filter(site_id %in% c(6932,6946,6948,6949,6951,6952,6953,6954,
                        6955,6964,6978,6979,7061,7260,7272,7329,
                        7791,7794,7850,7858,7983)) %>% 
  filter(work_dt >= as.Date("2014-10-01 00:00:00") & work_dt < as.Date("2014-10-02 00:00:00")) %>%
  summarise(
    sum_impressions = sum(impressions),
    sum_clicks = sum(clicks),
    sum_cost = sum(cost),
  ) %>%
  collect() 

This code produces:

Error in exists(name, env) : invalid first argument



exists("con")

> exists(con)
Error in exists(con) : invalid first argument
> exists("con")
[1] TRUE
0

There are 0 answers