You need to divide and conquer... find out which step is breaking the pipe by
terminating it early at various points and if the problem is still not clear one
you know which step is broken then give us a reproducible example.
I am not familiar with RSQLServer specifically, but the version of dplyr that I
have installed (0.4.3) does not have a variant of the tbl function that is
adapted to it.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live
Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
On October 30, 2015 7:07:45 AM PDT, Abraham Mathew <mathewanalytics at
gmail.com> wrote:>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