artemklevtsov / RGA

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

Error: Unknown column 'dateHour' #34

Closed jbkunst closed 8 years ago

jbkunst commented 8 years ago

Hi @artemklevtsov

First of all, thanks for the package, I tried some package but this just works ;)

I made some tests and work put ga:date to dimensions and it worked. But now I can't use the get_ga function if ga:date is in the dimmensions.

I don't have any clue about this.

gadata <- get_ga("113913503",
                 start.date = "2016-01-01",
                 dimensions = "ga:source", # work
                 token = readRDS(".ga-token.rds")[[1]])

gadata <- get_ga("113913503",
                 start.date = "2016-01-01",
                 dimensions = "ga:date,ga:source", # dont work
                 token = readRDS(".ga-token.rds")[[1]])
> Error: Unknown column 'dateHour'

Session info:

> devtools::session_info()
Session info ------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.2.2 (2015-08-14)
 system   i386, mingw32               
 ui       RStudio (0.99.896)          
 language (EN)                        
 collate  Spanish_Chile.1252          
 tz       America/Buenos_Aires        
 date     2016-06-15                  

Packages ----------------------------------------------------------------------------------------------------------
 package    * version date       source        
 assertthat   0.1     2013-12-06 CRAN (R 3.2.2)
 curl         0.9.7   2016-04-10 CRAN (R 3.2.5)
 DBI          0.4-1   2016-05-08 CRAN (R 3.2.5)
 devtools     1.10.0  2016-01-23 CRAN (R 3.2.3)
 digest       0.6.9   2016-01-08 CRAN (R 3.2.3)
 dplyr      * 0.4.3   2015-09-01 CRAN (R 3.2.5)
 httr         1.1.0   2016-01-28 CRAN (R 3.2.3)
 jsonlite     0.9.21  2016-06-04 CRAN (R 3.2.5)
 knitr        1.13    2016-05-09 CRAN (R 3.2.5)
 lubridate    1.5.0   2015-12-03 CRAN (R 3.2.3)
 magrittr     1.5     2014-11-22 CRAN (R 3.2.2)
 memoise      1.0.0   2016-01-29 CRAN (R 3.2.3)
 plyr         1.8.4   2016-06-08 CRAN (R 3.2.5)
 R6           2.1.2   2016-01-26 CRAN (R 3.2.3)
 Rcpp         0.12.5  2016-05-14 CRAN (R 3.2.5)
 RGA        * 0.4.2   2016-04-08 CRAN (R 3.2.5)
 rsconnect    0.4.3   2016-05-02 CRAN (R 3.2.5)
 stringi      1.1.1   2016-05-27 CRAN (R 3.2.5)
 stringr      1.0.0   2015-04-30 CRAN (R 3.2.2)
 tibble       1.0     2016-03-23 CRAN (R 3.2.5)
 tidyr      * 0.5.1   2016-06-14 CRAN (R 3.2.5)
jbkunst commented 8 years ago

Mmm... now it works! Sorry but I can't replicate the error.

I'll close the issue, but I hope read some thoughts.

Regards,

JoshyStarr commented 8 years ago

I have the same issue

MarekLu commented 8 years ago

The same issue is in my R using this code:

get_ga(
  profileId = ga.id.a,
  start.date = date.start,
  end.date = date.end,
  dimensions = "ga:date",
  metrics = "ga:sessions,ga:pageviews",
  filters = filter.a)
> devtools::session_info()
Session info ------------------------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.2.3 (2015-12-10)
 system   i386, mingw32               
 ui       RStudio (0.99.879)          
 language (EN)                        
 collate  Czech_Czech Republic.1250   
 tz       Europe/Prague               
 date     2016-06-28                  

Packages ----------------------------------------------------------------------------------------------------------------------------------------------------------------
 package    * version date       source                            
 assertthat   0.1     2013-12-06 CRAN (R 3.2.5)                    
 colorspace   1.2-6   2015-03-11 CRAN (R 3.2.5)                    
 curl         0.9.7   2016-04-10 CRAN (R 3.2.5)                    
 devtools   * 1.11.1  2016-04-21 CRAN (R 3.2.5)                    
 digest       0.6.9   2016-01-08 CRAN (R 3.2.5)                    
 ggplot2    * 2.1.0   2016-03-01 CRAN (R 3.2.5)                    
 git2r        0.14.0  2016-03-13 CRAN (R 3.2.4)                    
 gtable       0.2.0   2016-02-26 CRAN (R 3.2.5)                    
 htmltools    0.3.5   2016-03-21 CRAN (R 3.2.5)                    
 httpuv       1.3.3   2015-08-04 CRAN (R 3.2.5)                    
 httr         1.1.0   2016-01-28 CRAN (R 3.2.5)                    
 jsonlite     0.9.19  2015-11-28 CRAN (R 3.2.5)                    
 knitr        1.12.3  2016-01-22 CRAN (R 3.2.5)                    
 lubridate    1.5.6   2016-04-06 CRAN (R 3.2.5)                    
 magrittr     1.5     2014-11-22 CRAN (R 3.2.5)                    
 memoise      1.0.0   2016-01-29 CRAN (R 3.2.5)                    
 mime         0.4     2015-09-03 CRAN (R 3.2.3)                    
 munsell      0.4.3   2016-02-13 CRAN (R 3.2.5)                    
 openssl      0.9.2   2016-02-26 CRAN (R 3.2.5)                    
 plyr         1.8.3   2015-06-12 CRAN (R 3.2.5)                    
 R6           2.1.2   2016-01-26 CRAN (R 3.2.5)                    
 Rcpp         0.12.5  2016-05-14 CRAN (R 3.2.5)                    
 RGA        * 0.4.2   2016-06-28 Github (artemklevtsov/RGA@7871637)
 scales       0.4.0   2016-02-26 CRAN (R 3.2.5)                    
 shiny      * 0.13.2  2016-03-28 CRAN (R 3.2.5)                    
 stringi      1.1.1   2016-05-27 CRAN (R 3.2.5)                    
 stringr      1.0.0   2015-04-30 CRAN (R 3.2.5)                    
 tibble       1.0     2016-03-23 CRAN (R 3.2.5)                    
 tidyr      * 0.5.0   2016-06-12 CRAN (R 3.2.3)                    
 withr        1.0.1   2016-02-04 CRAN (R 3.2.5)                    
 xtable       1.8-2   2016-02-05 CRAN (R 3.2.5)             
MarekLu commented 8 years ago

I updated all packages now and nothing changes, I still see Error: Unknown column 'dateHour'

artemklevtsov commented 8 years ago

Can you provide full traceback?

JoshyStarr commented 8 years ago

How do I do that?

The problem solved itself when I restarted R.

Great package.

Sent from my iPhone

On Jun 29, 2016, at 04:58, Artem Klevtsov notifications@github.com wrote:

Can you provide full traceback?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

MarekLu commented 8 years ago

Is this full traceback? Restart R doesn't help in my case :(

> traceback()
5: stop("Unknown column '", i, "'", call. = FALSE)
4: `$.tbl_df`(res, dateHour)
3: res$dateHour
2: get_report("data/ga", query, token, fetch.by)
1: get_ga(profileId = ga.id.a, start.date = date.start, end.date = date.end, 
       dimensions = "ga:date", metrics = "ga:sessions,ga:pageviews", 
       filters = filter.a)
MarekLu commented 8 years ago

This code returns Error: Unknown column 'dateHour'

ga.b <- get_ga(
  profileId = xxx,
  start.date = "2016-06-20",
  end.date = "2016-06-28",
  dimensions = "ga:date",
  metrics = "ga:sessions")

This code works, but I'like not to use fetch.by.

ga.b <- get_ga(
  profileId = xxx,
  start.date = "2016-06-20",
  end.date = "2016-06-28",
  dimensions = "ga:date",
  metrics = "ga:sessions",
  fetch.by = "day")
artemklevtsov commented 8 years ago

@MarekLu thank you for the traceback. Please try to reproduce with the latest git version.

MarekLu commented 8 years ago

The latest git version works without error. Thank you.