Read.csv vs read.table in data frames in R

If you try using read.table for a CSV file in R , it keeps popping up an error.

“Error in read.table(“rdata.csv”, header = TRUE) :
more columns than column names”

This is because the read.table function assumes that there is only one table to be considered.

Use read.csv instead . The process is way smoother.

Additionally, you can put header value as true or false. But piece of advice, do keep it as true. Helps when you are trying to mess around with the Data Frame functions.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s