Question: Q10. Elements of an R data frame can also be accessed the same way elements of a matrix are accessed using subscripts. Subsets of a
Q10. 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 themselves 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 Cars93 data set available in the package using data (Cars93, package-"MASS"). Use 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. Report the model name, the price range (low, high), highway mileage, and the weight of the cars that satisfy these conditions. This can be done in a single R expression; however, you may simplify the extraction to several steps Q10. 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 themselves 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 Cars93 data set available in the package using data (Cars93, package-"MASS"). Use 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. Report the model name, the price range (low, high), highway mileage, and the weight of the cars 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
Get step-by-step solutions from verified subject matter experts
