Question

In: Statistics and Probability

3. R has a built-in character vector of US State names, state.name. Use this character vector...

3. R has a built-in character vector of US State names, state.name. Use this character vector and R's character functions to answer the following questions.Show R code

(a) List all the US State names that are more than one word. How many are there?

(b) What is the longest US State name(s) (including spaces) and how long is it?

(c) What is the longest single word US State name and how long is it?

(d) List all the US State names, where all of the upper and lower case “a"s are replaced with a capital “Z".

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 built in R functions to calculate mean and standard deviation. Simulate the X vector with...
Using built in R functions to calculate mean and standard deviation. Simulate the X vector with a length of 50 from a normal distribution with mean 2 and variance 1. Using a for() loop, create 100 different confidence intervals and also create a variable that keeps a count of how many of these confidence intervals contain the true mean 2. Hint: Use If/else statement to keep track of whether the confidence interval contains the true mean or not within the...
a. In R there is an built in data frame Nile. This has the annual flow...
a. In R there is an built in data frame Nile. This has the annual flow in river Nile for year 1871 to 1971. Produce a time series plot. Print graph(s). b. add the title as "Nile River Annual Flow", x axis label as "Year" and y axis label as "Flow". Print graph(s). c. Add a horizontal line showing the average flow over these years. Print graph(s). d. Add text as: "Average Flow:" with the calculated average flow on the...
Use R code Create a vector V with 8 elements (7,2,1,0,3,-1,-3,4): Transform that vector into a...
Use R code Create a vector V with 8 elements (7,2,1,0,3,-1,-3,4): Transform that vector into a rectangular matrix A of dimensions 4X2 (4- rows, 2-columns); Create a matrix transpose to the above matrix A. Call that matrix AT; Calculate matrix products: A*AT and AT*A. Present the results. What are the dimensions of those two product matrices; Square matrixes sometimes have an inverse matrix. Try calculating inverse matrices (or matrixes, if you prefer) of above matrices (matrixes) A*AT and AT*A; Extend...
Use R functions search and objects to find all possible R built-in functions related to exp...
Use R functions search and objects to find all possible R built-in functions related to exp distribution. rexp should be one of them. dexp is another one. Explain what the following two lines of codes do: curve(dexp, from=0, to=4)
Instructions tell you how to get the data in R R has built in dataset called...
Instructions tell you how to get the data in R R has built in dataset called Iris. This famous (Fisher's or Anderson's) iris data set gives the measurements in centimeters of the variables sepal length and width and petal length and width, respectively, for 50 flowers from each of 3 species of iris. The species are Iris setosa, versicolor, and virginica. We are interested in estimating the length of Petal (Y) using the length of Sepal (X). First, load the...
Determine if the vector(s), polynomial(s), matrices are linearly independent in R^3, P3(R), M 2x2 (R). Show...
Determine if the vector(s), polynomial(s), matrices are linearly independent in R^3, P3(R), M 2x2 (R). Show algebraically how you found your answer. a. < 2, 1, 5 > , < -2, 3, 1 > , < -4, 4, 1 > b. x^3 - 3x^2 + 2x +1, -2x^3 + 9x^2 -3, x^3 + 6x c. | 1 2 | | -3, -1 | | -4  2 | , | 2 1|
R has a number of datasets built in. One such dataset is called mtcars. This data...
R has a number of datasets built in. One such dataset is called mtcars. This data set contains fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973-74 models) as reported in a 1974 issue of Motor Trend Magazine. We do not have to read in these built-in datasets. We can just attach the variables by using the code attach(mtcars) We can just type in mtcars and see the entire dataset. We can see the variable...
Hadoop has HDFS, which is the default built in FileSystem. Cloudera use this built-in default Java...
Hadoop has HDFS, which is the default built in FileSystem. Cloudera use this built-in default Java implementation. MapR has taken a different approach. What approach has MapR taken in its FileSystem implementation, and what may be the advantages and disadvantages of MapR's approach versus other vendors? If there are disadvantages, how can they be addressed? Look at the advantages and disadvantages from user, developer, administrator and risk perspective.
The State of DeNile built a new toll road 3 years ago for $900 million. The...
The State of DeNile built a new toll road 3 years ago for $900 million. The state can charge tolls on the road for the next 20 years and expects to spend $3 million per year on maintenance and toll collection. Toll revenue is expected to be $80 million per year. The state has recently received an offer from the Otto Corporation to lease the road for 20 years. The company will pay DeNile $1 billion and will receive exclusive...
In the real vector space R 3, the vectors u1 =(1,0,0) and u2=(1,2,0) are known to...
In the real vector space R 3, the vectors u1 =(1,0,0) and u2=(1,2,0) are known to lie in the span W of the vectors w1 =(3,4,2), w2=(0,1,1), w3=(2,1,1) and w4=(1,0,2). Find wi, wj ?{w1,w2,w3,w4} such that W = span({u1,u2,wk,wl}) where {1,2,3,4}= {i,j,k,l}.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT