无法使用 rga R 库从 Google 分析中获取数据

Unable to get data from Google analytics with rga R library

我正在尝试使用 rga 库,但出现此错误:

Error in parseJSON(txt) : lexical error: invalid char in json text.
                                       <!DOCTYPE html> <html lang=en> 
                     (right here) ------^

这是我的代码:

rga.open()
profiles<-ga$getProfiles()
ids<-profiles[1]
data <- ga$getData(ids[1],
                   start.date = "2014-12-01", 
                   end.date = "2014-12-04",  
                   metrics = "ga:sessions",  
                   dimensions = "ga:date",
                   max = 1500,
                   sort="",
                   filters="")

我测试了查询 https://ga-dev-tools.appspot.com/explorer/ 并且有效

代码有什么问题?

rga 软件包现在未维护。请尝试来自 CRAN 的 RGARGoogleAnalytics

我怀疑这是因为您的 ID 中有一个 space[1]