R Error when Reading Data: more columns than names (2 Examples)

In this tutorial, I’ll show how to deal with the error “more columns than column names” in R.

Example 1: Replicating the Error Message – more columns than column names

read.table("some_data.txt", # Error
           header = TRUE)

Example 2: Solving the Error Message – more columns than column names

read.table("some_data.txt", # Specifying comma-separator
           header = TRUE,
           sep = ",")

Related Tutorials

You may find some further R tutorials on topics such as extracting data, merging, matrices, and coding errors in the following list:

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top