Question

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.

Homework Answers

Answer #1

library(ggplot2)

#part 1
state.x77.df = data.frame(state.x77)

#part2
head(state.x77.df)

#part3
ggplot(state.x77.df, aes(x=Income)) + geom_histogram(bins=12)

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
(1) Write R code to install the package named "MASS" only if the package is not...
(1) Write R code to install the package named "MASS" only if the package is not already installed on the machine. Then attach that package to your current workspace to use it in your programming. Your code below (2) Write R code to find what datasets are available only for the MASS package by creating a file named "R data sets". Your code below (3) Write R code to bring up the documentation page for the "Boston" dataset. Your code...
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...
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.
Use R to do each of the following. Use R code instructions that are as general...
Use R to do each of the following. Use R code instructions that are as general as possible, and also as efficient as possible. Use the Quick-R website for help on finding commands. 1. Enter the following values into a data vector named Dat: 45.4 44.2 36.8 35.1 39.0 60.0 47.4 41.1 45.8 35.6 2. Calculate the difference between the 2nd and 7th entries of this vector using only reference indices. 3. Calculate the median of Dat. 4. Sort the...
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.
Use the R package “UsingR” to download the data file (called “aid”) about monthly payment for...
Use the R package “UsingR” to download the data file (called “aid”) about monthly payment for federal program to R. Use R code to check whether it is a vector or matrix. Then assign “payment” as a vector based on the payment amounts only by removing the names of the states. Use the appropriate vector functions to rank, to sort, and to order the payment vector. Call these vectors as rank.payment, sorted.payment, and ordered.payment, Then use R code to make...
This assignment is going to use the data set in R called "airquality" that has 6...
This assignment is going to use the data set in R called "airquality" that has 6 variables, as described below. airquality: A data frame with 154 observations on 6 variables. [,1] Ozone numeric Ozone (ppb) [,2] Solar.R numeric Solar R (lang) [,3] Wind numeric Wind (mph) [,4] Temp numeric Temperature (degrees F) [,5] Month numeric Month (1--12) [,6] Day numeric Day of month (1--31) Using a significance level of 0.05, is there evidence to support that the Temp can be...
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...
2.) In this problem, we will perform multiple regression on the Boston housing data. The data...
2.) In this problem, we will perform multiple regression on the Boston housing data. The data contains 506 records with 14 variables. The variable medv is the response variable. Solve the following problems in R and print out the commands and outputs : To assess the data use library(MASS) data(Boston) (a) First perform a multiple regression with all the variables, what can you say about the significance of the variables based on only the p-values. Next use the ”step” function...
Using R and install.packages("MASS"), library(MASS) 1. Generate the following vector using at least two methods. 0,...
Using R and install.packages("MASS"), library(MASS) 1. Generate the following vector using at least two methods. 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4 2. Generate the following vector. Apple1, Banana2, Orange3, Cranberry4, Watermelon5 3. Generate the following vector using the “rep” function. a, a, b, b, c, c, a, a, b, b, c, c 4. In vector y = (8, 3, 5, 7, 6, 6, 8, 9, 2, 3, 9, 4, 10, 4, 11), which elements of y contains...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT