artemklevtsov / RGA

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

Error in vapply(x, function(x) RGA, get_ga() fetch.by="week" #58

Open Ashwin611 opened 5 years ago

Ashwin611 commented 5 years ago

When I use this query to get android data(profileID) it works fine for fetch.by="week" parameter. but I get an error while using fetch.by="day"

"Error in vapply(x, function(x) as.numeric(x[[name]]), numeric(1)) : values must be length 1, but FUN(X[[1]]) result is length 0"

I get the same error while retrieving iOS data or Website data. A similar error is encountered if I use more than 150 filters in OR condition at a time.

If this error means I should try to get fewer data why does it work well for android but not for iOS, (given the android data is much more than iOS data.)

dimension1 <- "ga:productSku==17186,ga:productSku==16381"

(but 150 such productIDs)

This works fine

app_city_android <- get_ga(profileId = "ga:**(ID_for_Android)", start.date = start_date_char, end.date = end_date_char, metrics = "ga:users", dimensions = "ga:sourceMedium,ga:dimension1", sort = NULL, filters = propertyID1, segment = NULL, samplingLevel ="HIGHER_PRECISION", start.index = NULL, max.results = NULL, include.empty.rows = NULL, fetch.by = "week", token = ga_token)

This gives an error

app_city_iOS <- get_ga(profileId = "*****(ID_for_iOS)", 
                       start.date = start_date_char,
                       end.date = end_date_char, 
                       metrics = "ga:users", 
                       dimensions = "ga:sourceMedium,ga:dimension1",
                       sort = NULL, 
                       filters = propertyID1,
                       segment = NULL,
                       samplingLevel =NULL,
                       start.index = NULL,
                       max.results = NULL, 
                       include.empty.rows = NULL, 
                       fetch.by = "week",
                       token = ga_token)

This too gives that error

app_city_android <- get_ga(profileId = "ga:**(ID_for_Android)", start.date = start_date_char, end.date = end_date_char, metrics = "ga:users", dimensions = "ga:sourceMedium,ga:dimension1", sort = NULL, filters = propertyID1, segment = NULL, samplingLevel ="HIGHER_PRECISION", start.index = NULL, max.results = NULL, include.empty.rows = NULL, fetch.by = "day", token = ga_token)

Originally posted by @Ashwin611 in https://github.com/artemklevtsov/RGA/issues/27#issuecomment-433917357