简体   繁体   中英

Google Prediction using R

Has anyone successfully used the Google Predication API from within R? My goal is to perform the following tasks:

  • Upload and manage the data in Google Storage
  • Use this data to train a model from Google Prediction

I have followed the install instructions located here and here (when using Windows). I have not been able to successfully connect using both Mac OSX and Windows.

I suspect that the core issue is authentication. There is scattered documentation and I feel like I have tried everything (even the overview of the R package designed for this purpose).

I am not the greatest programmer, but I can typically follow along with code and piece together what I need from worked examples. At this point, though, I simply do not know what else to try.

Many thanks in advance.

Marc Cohen seems to be right, I think something is broken. However I managed to pass authentication, here is how:

Download the googlepredictionapi_0.12.tar.gz and extract it inside a temporary folder. Then open googlepredictionapi/R/prediction_api_init.R inside an Editor and remove the lines

myEmail <- ""
myPassword <- ""
myAPIkey <- ""

Afterwards repackage the source files and load them in R:

tar czf googlepredictionapi.mod.tar.gz googlepredictionapi
R
remove.packages("googlepredictionapi")

Now you should be able to follow the steps in [1] http://code.google.com/p/r-google-prediction-api-v12/ . However instead of calling

install.packages("googlepredictionapi_0.12.tar.gz", repos=NULL, type="source")

you need to call

install.packages("googlepredictionapi.mod.tar.gz", repos=NULL, type="source")

Following the steps, at some point a file $HOME/.auth-token should be generated.

(You can even explicitly trigger this by calling explicitely: PredictionApiUtilGetAuth(verbose=TRUE) , myEmail and myPassword must be set beforehands.)

For some reason the global variables that are manually set in [1] have been shadowed by the removed lines above. The same is actually true for the verbose option which you can pass to most API function calls as extra option ..., verbose=TRUE) .

Hope this helps.

最后我听说(今年4月),对Google Prediction API的R支持尚未升级为使用OAuth,因此当Prediction API从旧的客户端登录方案切换到OAauth 2.0时,它有效地破坏了R功能。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM