[R] Error: Invalid First Argument in DPlyr

Abraham Mathew mathewanalytics at gmail.com
Fri Oct 30 15:07:45 CET 2015


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





-- 


*Abraham MathewData Ninja and Statistical Modeler*



*Minneapolis, MN720-648-0108 at abmathewksAnalytics_Blog
<https://mathewanalytics.wordpress.com/>*

	[[alternative HTML version deleted]]



More information about the R-help mailing list