Reading in CSV and Specifying Column Names

I saw some posts on this, but am not a super advanced programmer.

All I need to do is specify the column types when I create a data frame from a csv. Right now,

main <- read.csv(file = 'main.csv')

is putting first name as a Logical, date of birth as a text field, etc.

How do I read this in, and tell it to create a column called First_Name as a character/string, DOB as a date, etc.?

I do not think that read.csv will do this. you might try the tidyverse read_csv which seems to make same intelligent guesses but in some cases you may have to do the conversions after loading the data.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.