1

I am trying to pull weather data from NOAA's API I've downloaded rnoaa, httrm and jsonlite packages.

I want to run this piece of code

ncdc_stations(datasetid='GHCND', locationid='FIPS:12017', stationid='GHCND:USC00084289')

I get the error message:

Error in getOption("noaakey", stop("need an API key for NOAA data")) : need an API key for NOAA data

I have a token, how do I implement it into the code?

Thanks

1 Answers1

2

Welcome to SO! I'm unfamiliar with the library but it sounds like you need to add token = "YOUR_TOKEN" into each function call, eg:

libary(rnoaa)
ncdc(datasetid = 'PRECIP_HLY', locationid = 'ZIP:28801',
     datatypeid = 'HPCP', limit = 5, token =  "YOUR_TOKEN")

or alternatively (and sounds much easier rather than including that argument for each rnoaafunction call), just use options(noaakey = "KEY_EMAILED_TO_YOU") once at the top of your script.

taken from: https://www.rdocumentation.org/packages/rnoaa/versions/0.9.5

dbo
  • 1,174
  • 1
  • 11
  • 19