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...
Write JavaScript codes that count how many As, Bs, Cs in the following scores array, and...
Write JavaScript codes that count how many As, Bs, Cs in the following scores array, and calculate the average of the scores (Note: you can’t hard code the computation) A range >=90; 90>B range >=80; 90> C range >=70
Hello, below is the STATA question i am having trouble with. I understand you dont have...
Hello, below is the STATA question i am having trouble with. I understand you dont have the dataset, however, is there any help you may please provide? Maybe the commands in STATA needed for this problem? Thank you. Please download the hprice dataset (housing prices) and answer the following questions: 1. Run a regression where your x variable is age and your y variable is price. a) What is the null hypothesis? Alternate hypothesis? b) Do you expect the coefficient...
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.
How can you determine if you need to use a combination or permutation to count the...
How can you determine if you need to use a combination or permutation to count the number of outcomes? Which will usually have more outcomes? Why? Provide an example in your explanation.
Many states have increased their state's minimum wage recently. Based on the material learned this week...
Many states have increased their state's minimum wage recently. Based on the material learned this week please answer how this increase would impact the labor market and other markets in those states? Please provide your reasoning.
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!
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT