artemklevtsov / RGA

A Google Analytics API client for R
http://cran.r-project.org/package=RGA
32 stars 13 forks source link

errors with fetch.by and segments #21

Closed jamespmcguire closed 8 years ago

jamespmcguire commented 8 years ago

I am getting a vapply error when I run get_ga with both segment and the fetch.by argument:

> get_ga(start.date = "2015-12-01", end.date = "2016-01-31", metrics = "ga:sessions", dimensions = "ga:yearMonth")
  yearMonth sessions
1    201512  7358148
2    201601  8031525
> get_ga(start.date = "2015-12-01", end.date = "2016-01-31", metrics = "ga:sessions", dimensions = "ga:yearMonth", fetch.by = "month")
  yearMonth sessions
1    201512  7358148
2    201601  8031525
> get_ga(start.date = "2015-12-01", end.date = "2016-01-31", metrics = "ga:sessions", dimensions = "ga:yearMonth", segment = "gaid::-2")
  yearMonth sessions
1    201512  3696892
2    201601  3949445
> get_ga(start.date = "2015-12-01", end.date = "2016-01-31", metrics = "ga:sessions", dimensions = "ga:yearMonth", segment = "gaid::-2", fetch.by = "month")
Error in vapply(x, function(x) x[[name]], numeric(1)) : 
  values must be type 'double',
 but FUN(X[[1]]) result is type 'character'
> traceback()
5: vapply(x, function(x) x[[name]], numeric(1))
4: sum_by(pages, "sampleSize")
3: fetch_by(path, query, by, token)
2: get_report("data/ga", query, token, fetch.by)
1: get_ga(start.date = "2015-12-01", end.date = "2016-01-31", metrics = "ga:sessions", 
       dimensions = "ga:yearMonth", segment = "gaid::-2", fetch.by = "month")
artemklevtsov commented 8 years ago

Thank you for the report. Error occurs when one of the page have a sampled data,