[R] rnoaa library

Jeff Reichman re|chm@nj @end|ng |rom @bcg|ob@|@net
Sun Dec 29 20:50:58 CET 2019


r-help Forum

Anyone familiar with the "rnoaa" library?  I'm trying to pull NOAA  temp
data. I have a key but when I run the code highlighted in yellow  ..

Warning message:
Sorry, no data found 

No matter what station_id I use. 

# library
library(rnoaa)
library(lubridate)

# set key
options(noaakey = "<Enter key>")

start_date = "2018-01-15"
end_date = "2018-01-31"
station_id = "USW00013994"

weather_data <- ncdc(datasetid='NORMAL_HLY', stationid=paste0('GHCND:',
station_id),
                     datatypeid = "HLY-TEMP-NORMAL",
                     startdate = start_date, enddate = end_date, limit=500)
data <- weather_data$data 

data$year <- year(data$date)
data$month <- month(data$date)
data$day <- day(data$date)
# summarize to average daily temps
aggregate(value ~ year + month + day, mean, data = data)

Sincerely

Jeff Reichman


	[[alternative HTML version deleted]]



More information about the R-help mailing list