In R, I am trying to only read the first four columns of a text file. Is there a way to do this? This is some example code:
example <- read.table("example.txt", header=TRUE)
When I run this, I get the following error message:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 1 did not have 9 elements
This is why I only want to read in the first four columns.