In R - say I have a dataset (data) with the columns "mpg", "car", "cylinders". Is there a way to display the first 10 rows of data for just "mpg" and "car"?
head(data,10) works fine, but displays all 3 columns - I wasn't sure if there was a way to display less columns without actually subsetting?
head(data,10)
Try
head(data[c("mpg","car")],10)
or
head(data,10)[c("mpg","car")]
2.1m questions
2.1m answers
60 comments
57.0k users