Question

R Language Use the state.x77 data matrix and the tapply() function to obtain: (1)   The number...

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.

Homework Answers

Answer #1

(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
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Use the state package in R. 1. Turn the matrix into a data frame named \state.x77.df"....
Use the state package in R. 1. Turn the matrix into a data frame named \state.x77.df". 2. Print the rst six values of the data frame. 3. (3 pts) Make a histogram for the variable \Income" in ggplot using 12 bins.
R Language: Examine the R expression pairs(iris[1:4], main="Andersen's Iris Data -- 3 species", pch=20, col=unclass(iris$Species)+2) Use...
R Language: Examine the R expression pairs(iris[1:4], main="Andersen's Iris Data -- 3 species", pch=20, col=unclass(iris$Species)+2) Use a similar expression to produce a scatter plot matrix of the variable mpg, disp, hp, drat, and qsec in the data frame mtcars. Use different colors to identify cars belonging to each of the categories defined by the carsize variable.
The data frame `x77` contains data from each of the fifty United States. First coerce the...
The data frame `x77` contains data from each of the fifty United States. First coerce the `state.x77` variable into a data frame with:* ```{r, eval=FALSE} x77 <- data.frame(state.x77) ``` *For the following, make a scatter plot with the regression line:* 1. *The model of illiteracy rate (`Illiteracy`) modeled by high school graduation rate (`HS.Grad`).* 2. *The model of life expectancy (`Life.Exp`) modeled by the murder rate (`Murder`).* 3. *The model of income (`Income`) modeled by the illiteracy rate (`Illiteracy`).* *Write...
Suppose that the following frequency table contains data on the number of absences in a school...
Suppose that the following frequency table contains data on the number of absences in a school year due to illness or injury for 100 randomly selected high school students. Use the table to determine the median number of absences for these 100 students. Provide your answer with precision to one decimal place. Number of absences 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 Frequency 25, 10, 10, 5, 9, 12, 9, 9, 4, 2, 3, 2...
Problem 10.3: For each of these computations, say what R function is the most appropriate: 1.Count...
Problem 10.3: For each of these computations, say what R function is the most appropriate: 1.Count the number of cases in a data table. 2.List the names of the variables in a data table. 3.For data tables in an R package, display the documentation (“codebook”) for the data table. 4.Load a package into your R session. 5.Mark a data table as grouped by one or more categorical variables.
Suppose that the following frequency table contains data on the number of absences in a school...
Suppose that the following frequency table contains data on the number of absences in a school year due to illness or injury for 100 randomly selected high school students. Use the table to determine the median number of absences for these 100 students. Provide your answer with precision to one decimal place.   Number of absences     Frequency   0 25 1 10 2 10 3 5 4 9 5 12 6 9 7 9 8 4 9 2 10 3 11 2...
Use the programming language R to code the following project.. * Make sure you turn in...
Use the programming language R to code the following project.. * Make sure you turn in your code and answers from each question. (not the raw data). 1. Generate 1000 random samples of size 40 from the normal distribution with mean µ = 3 and standard deviation σ = 2. Compute 95% the confidence interval of 1000 samples and find the rate of confidence interval contains the true mean. What did you learn from this simulation study? 2. For each...
(1 point) College Graduation Rates.  Data from the College Results Online website compared the 2011 graduation rate...
(1 point) College Graduation Rates.  Data from the College Results Online website compared the 2011 graduation rate and school size for 92 similar-sized public universities and colleges in the United States. Statistical software was used to create the linear regression model using size as the explanatory variable and graduation rate as the response variable. Summary output from the software and the scatter plot are shown below. Round all calculated results to four decimal places. Coefficients Estimate Std. Error t value Pr(>|t|)...
Use the data mtcars in R: 1. Describe the data in R. (e.g., how many variables,...
Use the data mtcars in R: 1. Describe the data in R. (e.g., how many variables, types of variables). 2. Clean the data by deleting missing values. 3. Normalize the data/standardize the variables. 4. Determine the number of clusters. 5. Use k means cluster analysis. 6. Get cluster means. 7. Visualize the clustering result.
QUESTION 1 · 1 POINT The following frequency table summarizes a set of data. What is...
QUESTION 1 · 1 POINT The following frequency table summarizes a set of data. What is the five-number summary? Value Frequency 2 3 3 2 5 1 6 3 7 1 8 2 11 3 Select the correct answer below: Min Q1 Median Q3 Max 2 7 9 10 11 Min Q1 Median Q3 Max 2 3 6 8 11 Min Q1 Median Q3 Max 2 3 4 8 11 Min Q1 Median Q3 Max 2 6 8 10 11...