Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help figuring out the R codes for these problems! Please include the resu

ID: 2925242 • Letter: I

Question


I need help figuring out the R codes for these problems!

Please include the result together with the R codes in your work. 1. (10 pts) Assume that the Zoo at Nashville tends to purchase three animals of different genders: monkeys, giraffes, and hyenas. The following table is the plan: Monkeys Giraffes Hyenas Mal Female 10 1) Find the relative frequencies of female for different animals 2) use R to make a stacked bar plot based on the relative frequencies of genders among different animals (similar as Figure 1.2(right) on page 5 of the textbook). 3) Use R to make a juxtaposed bar plot based on the frequencies of genders among different animals (similar as Figure 1.2(left) on page 5 of the textbook)

Explanation / Answer

1) relative frequency

Monkeys female= 5/15 * 100%=33%

Giraffes female=7/11 * 100%=63.63%

Hyenas female=5/11 *100%=45.45%

2)

R code

Data= read.table(file.choose(),header=T) #cut and paste the data table in a notepad or create the data table in notepad,choose the file

barplot(as.matrix(Data)) # it will give the plot

3) for juxtaposed barplot do the bar plot as before with option beside=T

i.e, barplot(as.matrix(Data),beside=TRUE)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote