skardhamar / rga

R Google Analytics
187 stars 90 forks source link

Error when no results returned. #63

Open pugzor opened 9 years ago

pugzor commented 9 years ago

Hi,

When attempting to add a date filter in some lines return a null value, which I think is causing the following error:

Run (1/466): for date 2013-09-24
Error in if (nrow(ga.data$rows) < ga.data$totalResults && (messages ||  : 
  missing value where TRUE/FALSE needed

For reference, my query looks like the following:

mydata9999 <- ga$getData(ids = "ga:xxxxxxxx", batch = TRUE, walk = TRUE, start.date =
"2013-09-24", end.date = "2015-01-02", metrics =
"ga:pageviews,ga:uniquePageviews,ga:sessions,ga:users,ga:bounces", dimensions =
"ga:yearMonth,ga:userType", filter = "ga:yearMonth=~^20(1412|1411|1312)")

Is this a bug or just me being retarded? The query seems to run fine when using other filters.

toncek87 commented 8 years ago

you can try:

tryCatch({ mydata9999 <- ga$getData(ids = "ga:xxxxxxxx", batch = TRUE, walk = TRUE, start.date = "2013-09-24", end.date = "2015-01-02", metrics = "ga:pageviews,ga:uniquePageviews,ga:sessions,ga:users,ga:bounces", dimensions = "ga:yearMonth,ga:userType", filter = "ga:yearMonth=~^20(1412|1411|1312)") }, error=function(e){})