Question: R Studio Elements of an R data frame can also be accessed the same way elements of a matrix are accessed using subscripts. Subsets of

R Studio

Elements of an R data frame can also be accessed the same way elements of a matrix are accessed using subscripts. Subsets of a data frame extracted this way will be data frames, except when they are single rows, columns or scalars. In general, a single row will be a data frame and a single column, an R vector. Load the package named MASS and the data frame names Cars93 in this package using install.packages(MASS), library(MASS), View(Cars93), attach(Cars93). Using subscripting operations on Cars93 to find the vehicles with highway mileage of less than 25 miles per gallon (variable MPG.highway) and weight (variable Weight) over 3500 lbs. (Notice that R is case sensitive) Print the model name (Model), the price range (Min.Price, Max.Price), highway mileage (MPG.highway), and the weight of the cars (Weight) that satisfy these conditions. This can be done in a single R expression; however, you may simplify the extraction to several steps.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!