Question

In: Math

question about R: The vectors state.name, state.area, and state.region are pre-loaded in R and contain US...

question about R:

The vectors state.name, state.area, and state.region are pre-loaded in R and contain US state names, area (in square miles), and region respectively.

(a) Identify the data type for state.name, state.area, and state.region.

(b) What is the longest state name (including spaces)? How long is it?

(c) Compute the average area of the states which contain the word “New” at the start of the state name. Use the function substr().

(d) Use the function table() to determine how many states are in each region. Use the function kable() to include the table in your solutions. (Notes: you will need the R package knitr to be able to use kable().

Solutions

Expert Solution

Data sets related to the 50 states of the United States of America.

Usage

state.abb
state.area
state.center
state.division
state.name
state.region
state.x77

Details

R currently contains the following “state” data sets. Note that all data are arranged according to alphabetical order of the state names.

state.abb:

character vector of 2-letter abbreviations for the state names.

state.area:

numeric vector of state areas (in square miles).

state.center:

list with components named x and y giving the approximate geographic center of each state in negative longitude and latitude. Alaska and Hawaii are placed just off the West Coast.

state.division:

factor giving state divisions (New England, Middle Atlantic, South Atlantic, East South Central, West South Central, East North Central, West North Central, Mountain, and Pacific).

state.name:

character vector giving the full state names.

state.region:

factor giving the region (Northeast, South, North Central, West) that each state belongs to.

state.x77:

matrix with 50 rows and 8 columns giving the following statistics in the respective columns.

Population:

population estimate as of July 1, 1975

Income:

per capita income (1974)

Illiteracy:

illiteracy (1970, percent of population)

Life Exp:

life expectancy in years (1969–71)

Murder:

murder and non-negligent manslaughter rate per 100,000 population (1976)

HS Grad:

percent high-school graduates (1970)

Frost:

mean number of days with minimum temperature below freezing (1931–1960) in capital or large city

Area:

land area in square miles


Related Solutions

USING R ---locate the pre-loaded MASS package, then load the data frame cats within that packag....
USING R ---locate the pre-loaded MASS package, then load the data frame cats within that packag. This provides data on sex, body weight (in kgs), and heart weight (in grams) for 144 household cats. Load the MASS package with a call to library("MASS"), and access the object directly by entering cats at the console prompt. 1. Fit a least-squares multiple linear regression model using heart weight as the response variable and the other two variables as predictors, and view a...
Show how Rotation Matrix R transforms vectors to vectors
Show how Rotation Matrix R transforms vectors to vectors
R programing question Generate two vectors x and y of length B=10000 so that each of...
R programing question Generate two vectors x and y of length B=10000 so that each of the entries is independent, with Xi ~ N(0,1) and Yi ~ N(1,4) for i=1,2,...,10000
Using Classes This problem relates to the pre-loaded class Person. Using the Person class, write a...
Using Classes This problem relates to the pre-loaded class Person. Using the Person class, write a function print_friend_info(person) which accepts a single argument, of type Person, and: prints out their name prints out their age if the person has any friends, prints 'Friends with {name}' Write a function create_fry() which returns a Person instance representing Fry. Fry is 25 and his full name is 'Philip J. Fry' Write a function make_friends(person_one, person_two) which sets each argument as the friend of...
You run a firm called Hammocks ‘R Us (R Us) and are in a duopoly with...
You run a firm called Hammocks ‘R Us (R Us) and are in a duopoly with Hammocks, Hammocks, Hammocks (HHH). You both sell hammocks, but your products are differentiated. You and your competitor compete on price with each firm facing a demand curve: Qrus = 24 − 2Prus + 2Phhh and Qhhh= 24 − 2Phhh + 2Prus You each face a fixed cost of $5 and no variable costs. A) Explain why own price has a negative sign in the...
Let (R 3 , ×) be the set of 3d vectors equipped with the operation of...
Let (R 3 , ×) be the set of 3d vectors equipped with the operation of vector crossproduct. Which of the following properties does this operation satisfy (give proofs in all cases)? (a) has identity element(s)? (If so, determine all identity elements.) (b) has idempotent element(s)? (If so, determine all idempotent elements.) (c) commutative? (d) associative?
The correlation coefficient r is a sample statistic. What does it tell us about the value...
The correlation coefficient r is a sample statistic. What does it tell us about the value of the population correlation coefficient ρ (Greek letter rho)? You do not know how to build the formal structure of hypothesis tests of ρ yet. However, there is a quick way to determine if the sample evidence based on ρ is strong enough to conclude that there is some population correlation between the variables. In other words, we can use the value of r...
The correlation coefficient r is a sample statistic. What does it tell us about the value...
The correlation coefficient r is a sample statistic. What does it tell us about the value of the population correlation coefficient ρ (Greek letter rho)? You do not know how to build the formal structure of hypothesis tests of ρ yet. However, there is a quick way to determine if the sample evidence based on ρ is strong enough to conclude that there is some population correlation between the variables. In other words, we can use the value of r...
The correlation coefficient r is a sample statistic. What does it tell us about the value...
The correlation coefficient r is a sample statistic. What does it tell us about the value of the population correlation coefficient ρ (Greek letter rho)? You do not know how to build the formal structure of hypothesis tests of ρ yet. However, there is a quick way to determine if the sample evidence based on ρ is strong enough to conclude that there is some population correlation between the variables. In other words, we can use the value of r...
The correlation coefficient r is a sample statistic. What does it tell us about the value...
The correlation coefficient r is a sample statistic. What does it tell us about the value of the population correlation coefficient ρ (Greek letter rho)? You do not know how to build the formal structure of hypothesis tests of ρ yet. However, there is a quick way to determine if the sample evidence based on ρ is strong enough to conclude that there is some population correlation between the variables. In other words, we can use the value of r...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT