Please help me to solve this question in R I need all steps

Please help me to solve this question in R. I need all steps and R-code. Thank you


Please help me to solve this question in R. I need all steps and R-code. Thank you


Run the following line to obtain a bivariate table for hair and eye color in a sample of 279 men. Make a stacked relative frequency barplot with hair color on the z-axis. Add a legend. Use the Make a stacked relative frequency barplot with hair color on the z axis. Add a legend. Use the category colors \"saddlebrown\" for brown eyes, \"lightblue\" for blue eyes, \"violet\" for hazel eyes, and \"palegreen\" for green eyes male. HairEyeColor HairEyeColor I, ,11 Among blonds, what eye color is most prevalent in the sample?

Solution

You did not provide the data so i cannot give you the output. But the generic R-code is as follows

Let f_i denote the frequency of ith class and N be the total frequency. Then relative frequency in R can be computed as follows, say we have k classes

rel.freq=rep(0,k)

hair colour=c(\"brown\",\"blue\",\"violet\",\"palegreen\")

for(i in 1:k)

{

rel.freq[i]=f[i]/N

}

barplot(rel.freq,x=hair color, colours=c(\"saddlebrown\",\"lightblue\",\"violet\",\"palegreen\")

legend(hair color,rel.freq,legend=\"\")

 Please help me to solve this question in R. I need all steps and R-code. Thank you Please help me to solve this question in R. I need all steps and R-code. Tha

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site