Comments (8)
Are you storing an instance on disk, per:
https://github.com/skardhamar/rga#advanced-use
from rga.
Yes. Or at least attempting to. I'm taking over code from a previous developer so perhaps it's not correct.
Here's what I have now. Should I be doing an open 3 times, or perhaps combine into one command? Do I need to fill in a specific file path after the "where" below, or does this default to the WD?
library(rga)
rga.open(instance="ga")
rga.open(instance="ga", where="~/ga.rga")
rga.open(instance = "ga",
client.id = "myclientid",
client.secret = "myclientsecret")
from rga.
No, 3 calls are not needed. This is what I do:
rga.open(instance = "ga", where="~/ga.rga",
client.id = getOption("ga.clientId"), client.secret = getOption("ga.clientSecret"))
The getOption()
is retrieving credentials from ~/.Rprofile
, in order to keep them out of the code.
Do I need to fill in a specific file path after the "where" below, or does this default to the WD?
The ~/
location refers to the home directory ($HOME
) of the user running the script. So, not the current working directory (WD). Though, you could store it there if you wanted to.
from rga.
OK, makes sense. I've kept it as Home (~/ga.rga), but I'm getting the following error: "Error in if (.self$tokenExpiresIn() <= 0) { : argument is of length zero"
I'm just running the following:
library(rga)
rga.open(instance = "ga", where="~/ga.rga",
client.id = getOption("ga.clientId"), client.secret = getOption("ga.clientSecret"))
I've also tried running the following first, in case I needed to store the ID/CS first:
ga.clientId <- "[myclientidhere]"
ga.clientSecret <- "[mygasecrethere]"
I get the same error each time.
I've also tried running just rga.open(instance="ga") and pasting in the code just in case I needed to have a successful instance opened at least once. When I do that the code you suggested works fine. But if I close R Studio and re-open, thereby ending the instance, I can't just run the code you suggested without getting that same "length zero" error.
What am I missing?
I really appreciate your help with this. I assuming I'm just missing something basic.
from rga.
When using the options
mechanism in R, you need to assign them as follow (this is an excerpt from my ~/.Rprofile
):
# Google Analytics credentials
options(ga.clientId = "[myclientidhere]")
options(ga.clientSecret = "[mygasecrethere]")
And, remember that every time you modify .Rprofile
you need to restart R for it to pick up the changes.
from rga.
Damn, I had already done that. Still getting that error. Not sure it's related to the GetOPtion, though. Because I still get the error even if I just declare it in the code such as
rga.open(instance = "ga", where="~/ga.rga",
client.id = "[myclientidhere]",
client.secret = "[mygasecrethere]")
I definitely intend to use the GetOption, though. Just doesn't seem to impact the error.
from rga.
Maybe the ~/ga.rga
instance file is corrupt? Maybe try deleting it, then re-running the rga.open()
call.
There's a status function that might provide some insight: ga$status()
. The output for me looks like:
> ga$status()
Client ID: [myclientidhere]
Client Secret: [mygasecrethere]
Where: ~/ga.rga
Is token valid: TRUE
Token expires in: 3584.93204188347 seconds
from rga.
Good call. That's exactly what I did and it seems to be working. I noticed that the timestamp for the ga.rga file wasn't updating even when I authenticated. So I deleted the file, closed down everything and started over. This time when I ran the code it asked me to authenticate and created a new ga.rga file.
I was just testing it before I posted an update.
Thanks for your help with this!
from rga.
Related Issues (20)
- Sign in with Google temporarily disabled for this app HOT 7
- Unable to install: Non-zero exit status HOT 2
- object 'ga' of mode 'S4' was not found
- Error 400 "not been reviewed or verified by Google" HOT 1
- Save/capture message "Notice: Data set contains sampled data" HOT 17
- Batch not working with Walk
- "Error : package 'bitops' required by 'RCurl' could not be found" HOT 5
- Unable to install
- rga package reluctant to import data split by dimensions containing an interval in their title HOT 1
- Error in if (.self$tokenExpiresIn() <= 0) { : argument is of length zero
- Problem installing package HOT 2
- Error in if (.self$tokenExpiresIn() <= 0) { : argument is of length zero HOT 1
- Please consider renaming this package HOT 2
- Cant Authorise RGA HOT 1
- rga not working under R Sweave HOT 1
- Error in charToDate(x) : character string is not in a standard unambiguous format HOT 1
- filters with pagePath
- And/or in filters HOT 2
- Error in parse_repo_spec(repo) : Invalid git repo specification: 'rga' HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rga.