GlobalFishingWatch / gfwr

R package for accessing data from Global Fishing Watch APIs
https://globalfishingwatch.github.io/gfwr/
Apache License 2.0
59 stars 7 forks source link

Update README.Rmd #61

Closed sketchkey closed 2 years ago

sketchkey commented 2 years ago

"key" argument missing for get_vessel_info & get_event( doesn't work for me without it) — thanks for making the package!!

tclavelle commented 2 years ago

Hi @sketchkey, thanks for posting an issue! For consistency, we should probably include the key argument in all examples. Most functions have a default of key = gfw_auth(), however, so they should work without specifying key so long as you've added your API token to your .Renviron file as described in the Authorization section of the README. Did you do that?

sketchkey commented 2 years ago

Hi @sketchkey, thanks for posting an issue! For consistency, we should probably include the key argument in all examples. Most functions have a default of key = gfw_auth(), however, so they should work without specifying key so long as you've added your API token to your .Renviron file as described in the Authorization section of the README. Did you do that?

Completely agree with the consistency idea — I have since added the API token to .Renviron (I was just being lazy when initially playing around with it 😅). Again, this package is awesome and will definitely be using/recommending this to folks for future projects!

tclavelle commented 2 years ago

@sketchkey Cool, just making sure it worked in that context. Thanks for the PR and glad you're finding the package useful!

sketchkey commented 2 years ago

Hi @sketchkey, thanks for posting an issue! For consistency, we should probably include the key argument in all examples. Most functions have a default of key = gfw_auth(), however, so they should work without specifying key so long as you've added your API token to your .Renviron file as described in the Authorization section of the README. Did you do that?

Hey @tclavelle — just following up on this as I had a colleague who was having issues getting the GFW token in their .Renviron file to work. It looks like if you name the token as "GFW_token" (with quotations per the Authorisation section), Sys.getenv doesn't find it, and calling the created key objects just gives an empty vector: ([1] "").

Tokens named without quotations work fine (GFW_TOKEN = "PASTE_YOUR_TOKEN_HERE")

I've only tested this by editing the .Renviron file for my current project (e.g. usethis::edit_r_environ("project"), but guessing this issue applies to both global and local edits. Have not made a pull request in case I'm missing something obvious, so feel free to let me know either way!