using readr want to use col_only() option
<p>My question how to use read_csv to read only certain columns BY NAME.  Example:</p>

<pre><code>tmp &lt;- 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 from Heart Attack" 
[2] "Hospital 30-Day Death (Mortality) Rates from Heart Failure"
[3] "Hospital 30-Day Death (Mortality) Rates from Pneumonia"
</code></pre>

<p>If I want to use read_csv and use col_only() option how can I only read one of these columns at a time.</p>

<p>Only thing I could come up with was:</p>

<pre><code>tt &lt;- read_csv("outcome-of-care-measures.csv", col_types = cols_only(Hospital 30-Day Death (Mortality) Rates from Heart Attack=col_character()), n_max = 10)
Error: unexpected numeric constant in "tt &lt;- read_csv("outcome-of-care-measures.csv", col_types = cols_only(Hospital 30
</code></pre>

<p><strong><em>I have a solid hunch my problem lays with using the name of the column given by names() , need some guidance.</em></strong></p>

<p>Trying to follow this example in my book:</p>

<pre><code>logdates &lt;- read_csv("data/2016-07-20.csv.gz", col_types = cols_only(date = col_date()), n_max = 10)
</code></pre>