R Language
Use the state.x77 data matrix and the tapply() function to obtain:
(1) The number of the states in each region.
(2) The names of the states in each division.
(3) The median high school graduation rates for groups of states defined by combinations of the factors state.region and state.size.
(1) use tapply on the vectors state.name and state.region against the function length
## Northeast South North Central West
## 9 16 12 13
(3) use the vectors HS Grad as the first argument and the list state.region and state.size as the second argument against the function median.
## Small Medium Large
## Northeast 55.9 56.00 51.45
## South 48.1 41.30 47.40
## North Central 53.3 54.50 52.90
## West 62.4 61.75 62.60
Get Answers For Free
Most questions answered within 1 hours.