r - using readr want to use col_only() option -


my question how use read_csv read columns name. example:

tmp <- read_csv("outcome-of-care-measures.csv")  dim(tmp) [1] 4706   46  names(tmp)[c(11,17,23)] [1] "hospital 30-day death (mortality) rates heart attack"  [2] "hospital 30-day death (mortality) rates heart failure" [3] "hospital 30-day death (mortality) rates pneumonia" 

if want use read_csv , use col_only() option how can read 1 of these columns @ time.

only thing come was:

tt <- read_csv("outcome-of-care-measures.csv", col_types = cols_only(hospital 30-day death (mortality) rates heart attack=col_character()), n_max = 10) error: unexpected numeric constant in "tt <- read_csv("outcome-of-care-measures.csv", col_types = cols_only(hospital 30 

i have solid hunch problem lays using name of column given names() , need guidance.

trying follow example in book:

logdates <- read_csv("data/2016-07-20.csv.gz", col_types = cols_only(date = col_date()), n_max = 10) 

basically tell name using should input differently. per sebastian-c advice backticks did trick.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -