Question

How many states have a population of over 4000k? Use R commands to count. Please note...

How many states have a population of over 4000k? Use R commands to count.
Please note that the state.x77 dataset needs to be used. Lastly, please provide the complete R code. Thank you.

Homework Answers

Answer #1

The rocde:

# to call the data
data=state.x77
View(data)
#to count the state greater than 4000k use library(plyr)
library(plyr)
No_of_state_true=count(data[,1]>4000);No_of_state_true

Output is:

> # to call the data
> data=state.x77
> View(data)
> #to count the state greater than 4000k use library(plyr)
> library(plyr)
> No_of_state_true=count(data[,1]>4000);No_of_state_true
x freq
1 FALSE 32
2 TRUE 18

Thus, the number of states that has a population over 4000 is 18.

Cheers!

Please let me know if you have any confusion. Thanks.

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
Instructions: You are not required to use R markdown for the lab assignment. Please include ALL...
Instructions: You are not required to use R markdown for the lab assignment. Please include ALL R commands you used to reach your answers in a word or pdf document. Also, report everything you are asked to do so Problem 2 : Answer the following questions: 1. First run alphas <- seq(0.1, 1, by = 0.1) and nalphas <- - rev(alphas). Based on what you have seen, describe how functions seq and rev work. Then run qnorm(c(nalphas, alphas)) and report...
Question (2) [5 marks] (Use R) Suppose you have a company producing cupcakes. Each cupcake is...
Question (2) [5 marks] (Use R) Suppose you have a company producing cupcakes. Each cupcake is supposed to contain 10 grams of sugar. The cupcakes are produced by a machine that adds the sugar in a bowl before mixing everything. You believe the machine does not add 10 grams of sugar for each cupcake. If your assumption is true, the machine needs to be fixed. You stored the level of sugar of thirty cupcakes. Note: You can create a randomized...
PLEASE USE R CODE!! Continue to generate standard normal random variables until you have generated n...
PLEASE USE R CODE!! Continue to generate standard normal random variables until you have generated n of them, where n≥100 is such that S/sqrt(n) <0.1, where S is the sample standard deviation of the n data value. (a)How many normals do you think will be generated? (b)What is the sample mean of all the normals generated? (c)What is the sample variance?
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...
Generate 1000 random numbers from Normal (mean=25, sd=3) and store in a vector. How many of...
Generate 1000 random numbers from Normal (mean=25, sd=3) and store in a vector. How many of these data points are greater than 26? (You can directly use built in functions in R or use conditional/unconditional iterations). Please provide your final R code and the output.
In R, how to use pt( ) to find the one-sided left-tail p-value for t=-1.98 with...
In R, how to use pt( ) to find the one-sided left-tail p-value for t=-1.98 with df=8? And what is the one-sided right-tail p-value for t=1.98 with df=8? And what is the two-sided p-value for t=1.98 with df=8? Print the code please, thank you!
How many seven-digit numbers are even and have a 3 in the hundreds place? Please explain...
How many seven-digit numbers are even and have a 3 in the hundreds place? Please explain this and how to understand the basic concept about this? step by step would be good too and with examples if you can. appreciate this. thank you.
CAN ANYONE SOLVE THIS BY USING R ? CAN YOU PLEASE NOT USE the (CORRECT=F FUNCTION)...
CAN ANYONE SOLVE THIS BY USING R ? CAN YOU PLEASE NOT USE the (CORRECT=F FUNCTION) WHEN SOLVING PART B, I AM NOT VERY CLEAR WITH THAT. 2) From a random sample of 673 items made by a particular manufacturing process, it is found that 27 are defective. (a) (1 mark) Find a 99.5% confidence interval for the proportion of defective items made by the process. (Also include the commands and output.) (b) (1 mark) Give the command and output...
usign R solve In a class survey, students are asked how many hours they sleep per...
usign R solve In a class survey, students are asked how many hours they sleep per night. In the sample of 22 students, the (sample) mean is 6.77 hours with a (sample) standard deviation of 1.472 hours. The parameter 1 of interest is the mean number of hours slept per night in the population from which this sample was drawn, and the distribution of sleep for that population follows a normal distribution. a. Which kind of confidence interval is appropriate...
I have the following question please: Consider the following sequence of numbers 8, 1, 11, 4,...
I have the following question please: Consider the following sequence of numbers 8, 1, 11, 4, 2, 9, 10, 5, 3, 12, 6, 7 Sort the list using quick sort with the middle element as pivot. Show the state of the list after each call to the partition procedure. You are not required to write code for this question. You need to trace through the different sorting algorithms using the given list Please could you provide me with a complete...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT