California Weather

Author

Derek Sollberger

Published

December 23, 2022

library("tidyverse")

I want to create and visualize a simple data set for my Data Science courses (that I teach in California).

Data Source

  • University of California
  • Agriculture and Natural Resources
  • Statewide Integrated Pest Management Program
  • https://ipm.ucanr.edu/WEATHER/wxactstnames.html

Fixed-Width Files

Today I learned how to read fixed-width files in the Tidyverse. From there, I simply need to give the columns easy-to-use names.

SF_df <- readr::read_fwf("SF_2021.txt")
Rows: 365 Columns: 7
── Column specification ────────────────────────────────────────────────────────

chr  (3): X1, X4, X7
dbl  (3): X3, X5, X6
time (1): X2

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
colnames(SF_df) <- c("date", "time", "precipitation",
                     "check1", "high", "low", "check2")