I have a file with this format
"date" "obs"
2010060101 0.015
2010060102 0.015
I can read it with
read.table("filehour.txt", header=TRUE)
To get:
date obs
1 2010060101 0.015
2 2010060102 0.015
3 2010060103 0.015
And I get a data.frame with the column names unquoted which is what I want so it works ok. But when I try to use the tidyverse style with read_table
to return a tibble instead of a data.frame like so:
read_table2("filehour.txt")
I get
-- Column specification -----------------------------------------------
cols(
`"date"` = col_double(),
`"obs"` = col_double()
)
with the header names quoted which I don't want because then I would have to reference them as
`"date"`
`"obs"`
I could name the column names with read_table parameter col.names
but isn't read_table2
the equivalent to read.table
or is there any other function or parameter to get the same results without having to explicitly name the columns using the tidyverse package?.