从RGA
库更新库到0.2.4后,
当我获取数据时,R返回以下错误消息:
错误:is.request(y)不为TRUE
使用RStudio或批处理模式时会发生这种情况。
这是我之前使用的代码:
firstdate(profile.id = profile_ID, token = ga_token_RGA)
和
get_ga(profile.id = profile_ID ,
start.date = "500daysAgo",
end.date = "yesterday",
metrics = "ga:users,ga:sessions",
dimensions = "ga:date",
token = ga_token_RGA)
因为它似乎与httr相关,所以我尝试使用以下方式使用httr:
remove.packages("httr")
install.packages("http://cran.r-project.org/src/contrib/Archive/httr/httr_0.6.1.tar.gz", repos=NULL, type="source")
但RGA需要版本1
loadNamespace中的错误(j< - i [[1L]],c(lib.loc,.libPaths()),versionCheck = vI [[j]]): 命名空间'httr'0.6.1已加载,但需要> = 1.0.0 错误:“RGA”
的包或命名空间加载失败
最后: 这是一个traceback()和一个sessionInfo()
library("RGA")
profile_ID <- ******************
first_date <- as.character(firstdate(profile.id = profile_ID, token = ga_token_RGA))
错误:is.request(y)不为TRUE
traceback()
16: stop(sprintf(ngettext(length(r), "%s is not TRUE", "%s are not all TRUE"), ch), call. = FALSE, domain = NA)
15: stopifnot(is.request(x), is.request(y))
14: f(init, x[[i]])
13: Reduce(request_combine, list(...))
12: c.request(req, token$sign(req$method, req$url))
11: c(req, token$sign(req$method, req$url))
10: request_prepare(req)
9: request_perform(req, hu$handle$handle)
8: GET(url, query = query, accept_json(), config)
7: get_response(type = type, path = path, query = query, token = token)
6: get_data(type = type, query = query, token = token)
5: get_report(type = "ga", query = query, token = token)
4: get_ga(profile.id = profile.id, start.date = "2005-01-01", end.date = "today",metrics = "ga:sessions", dimensions = "ga:date", filters = "ga:sessions>0",max.results = 1L, token = token)
3: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))
2: suppressWarnings(get_ga(profile.id = profile.id, start.date = "2005-01-01", end.date = "today", metrics = "ga:sessions", dimensions = "ga:date", filters = "ga:sessions>0", max.results = 1L, token = token))
1: firstdate(profile.id = profile_ID, token = ga_token_RGA)
sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS release 6.6 (Final)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base other attached packages:
[1] RGA_0.2.4
loaded via a namespace (and not attached):
[1] httr_1.0.0 R6_2.1.1 magrittr_1.5 tools_3.2.2 curl_0.9.3 Rcpp_0.12.1 stringi_0.5-5
[8] jsonlite_0.9.17 stringr_1.0.0 httpuv_1.3.3