Skip to contents

A dataset containing daily average temperatures of New York and San Francisco in 2021 as recorded by the US National Weather Service (NWS) at weather.gov.

Usage

temps

Format

A data frame (specifically a tbl_df) with 730 rows and 3 variables:

city

New York or San Francisco

date

Date in YYYY-MM-DD format

avg

Average temperature in degrees Fahrenheit (°F) rounded to the nearest half degree

Details

It is difficult to pull data from the NWS. It does not provide the data via an API and the data it returns through its point-and-click interface isn't in plain text format! To make matters worse, you can only retrieve data from a city one month at a time.

For San Francisco, visit https://www.weather.gov/wrh/climate?wfo=mtr and choose "San Francisco City, CA", "Daily data for a month", and a month from 2021; for New York, visit https://www.weather.gov/wrh/climate?wfo=okx and choose "NY-Central Park Area", "Daily data for a month", and a month from 2021. Copy and paste the data into spreadsheet software for further processing.

Examples

temps
#> # A tibble: 730 × 3
#>    city     date         avg
#>    <chr>    <date>     <dbl>
#>  1 New York 2021-01-01  36.5
#>  2 New York 2021-01-02  43.5
#>  3 New York 2021-01-03  36  
#>  4 New York 2021-01-04  39  
#>  5 New York 2021-01-05  39  
#>  6 New York 2021-01-06  37.5
#>  7 New York 2021-01-07  35.5
#>  8 New York 2021-01-08  32  
#>  9 New York 2021-01-09  30.5
#> 10 New York 2021-01-10  35  
#> # … with 720 more rows