Question: # Problem 3 We start from making the population in discussion material: {r} set.seed(2023) male = data.frame( length = rnorm (n=2000, mean =57.5, sd =3)

 \# Problem 3 We start from making the population in discussionmaterial: {r} set.seed(2023) male = data.frame( length = rnorm (n=2000, mean =57.5,sd =3) sex = rep ("Male",2000) female = data.frame ( length =

\# Problem 3 We start from making the population in discussion material: {r} set.seed(2023) male = data.frame( length = rnorm (n=2000, mean =57.5, sd =3) sex = rep ("Male",2000) female = data.frame ( length = rnorm (n=3000, mean =50.5,sd=2.8) sex = rep("Female", 3000) population_2 = bind_rows(male, female) {r} p1 > ggplot(aes( length)) + geom_histogram()+ geom_vline (aes( xintercept = mean ( population_2 $ length )) ) 2\. The code below generate the stacked histogram. Use 'ggarange' to show both plots in 1 plot, and give it suitable titles. {r} tr.:kable(population_2 1> group_by(sex) > summarise(average = mean(length), sd =sd( length))) (Hint: Think about the following code, and write similar things in 'mutate' for the 'sex') {r} string_vector =c("a","a","b") (string_vector =="a")5/6+( string_vector =="b")1/6 [1] 0.83333330.83333330.1666667 5\. Now we draw 300 samples without replacement** with the given weight. (Hint: ' 1> sample_n ( size = ?, replace = ?, weight = ?)') the result in the 'result_mean' and 'result_female_count' vectors and make a dataframe. (300(3000)/(2000+3000)). Use 'ggarange' to put it in one single plot. Use suitable title, axis label, themes, etc

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!