brad-cannell / r4epi

Repository for the R for Epidemiology book
http://www.r4epi.com/
Other
18 stars 50 forks source link

Tell them that they can change one column in their readr code without changing them all #141

Open mbcann01 opened 3 months ago

mbcann01 commented 3 months ago

I learned this when importing the street names data. In this code, I only wanted to change PostDirection from logical to character. Readr was guessing the other columns correctly. This was all I needed in my code:

read_csv("~/Dropbox/Datasets/Names/Street_Names.csv", 
    col_types = cols(
      PostDirection = col_character()
    )
)