Print one column of data frame with row names
An even easier way is data['c']
, which will result in the same output:
c
x 3
y 4
z 5
You can use the drop
argument (see also ?'['
):
data[,"c", drop=FALSE]
gives you a data.frame
c
x 3
y 4
z 5