skardhamar / rga

R Google Analytics
186 stars 89 forks source link

Can't get ga:date for visits #59

Closed OmarGonD closed 9 years ago

OmarGonD commented 9 years ago

Hi. im trying to pull the movile visitas for october with this code:

moviles-oct <- ga$getData(id, batch = TRUE, walk = TRUE, start.date="2014-10-01", end.date="2014-10-31", metrics = "ga:sessions", dimensions = "ga:date", sort = "", start = 1, max = 10,000)

but i get this warning:

Pulling 10 observations in batches of 10 Run (1/1): observations [1;10]. Batch size: 10 Error in format.POSIXlt(as.POSIXlt(x), ...) : invalid 'format' argument

What is going on? I just want to try first with october. And when i get the "query" working, i want to apply this to all 2014. I think the problem is the format of the date column. Because, when i use ga:month, and ga:day .... i get what i want... help pls.

BrianWeinstein commented 9 years ago

The error is with the comma in your max=10,000 parameter. R is reading this as max=10, and then some extra 000 parameter.

Your code should read:

moviles_oct <- ga$getData(profile, batch = TRUE, walk = TRUE, start.date="2014-10-01", end.date="2014-10-31", metrics = "ga:sessions", dimensions = "ga:date", sort = "", start = 1, max = 10000)

Also note that your variable name can't include dashes.

OmarGonD commented 9 years ago

thanks. I ended up upgradeting the package and R together. Thaks again.