0

I have to extract two columns from this data set (Cars93 on MASS) and create a separate folder consisting only of the two columns MPG.highway and EngineSize. How do I go about doing this?

You can look at Cars93 on Mass and just get the first ten rows to see it.

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
Alyse W
  • 1
  • 1
  • 1
  • 1

1 Answers1

3

You can create a subset using the names directly using the subset function or alternately,

new_df <- Cars93[,c("MPG.highway","EngineSize")]
#or
new_df <- subset(Cars93, keep = c("MPG.highway","EngineSize"))
SmitM
  • 1,346
  • 1
  • 6
  • 14