~/code/R/

Just want the second variable

If you just want the second variable:

B
NA
b
d
c

If every row doesn’t split into the same number of pieces, use the extra and fill arguments to control what happens

a b
a NA
a b
a b
NA NA

The same behaviour drops the c but no warnings

a b
a NA
a b
a b
NA NA

Or you can keep all three

a b c
a NA NA
a b NA
a b c
NA NA NA

convert = TRUE detects column classes

# 'data.frame': 5 obs. of  2 variables:
#  $ key  : chr  "a" "a" "c" "d" ...
#  $ value: chr  "1" "2" "4" NA ...
# 'data.frame': 5 obs. of  2 variables:
#  $ key  : chr  "a" "a" "c" "d" ...
#  $ value: int  1 2 4 NA NA

Argument col can take quasiquotation to work with strings

key value
a 1
a 2
c 4
d NA
NA NA