If you know that you'll have a maximum of 3 =
's in a line, you can force read.table
to allocate an extra column with colClasses
and fill
.
txt <- "a=2
b=3
c=4
d=5=6
e=7"
read.table(text=txt, sep="=", header=FALSE,
colClasses=c("character","character","character"), # create a 3rd column
fill=TRUE # don't fail because data for last column doesn't exist
)
V1 V2 V3
1 a 2
2 b 3
3 c 4
4 d 5 6
5 e 7