My question is that How to R programming and show me the code The article cited
ID: 3052729 • Letter: M
Question
My question is that How to R programming and show me the code
The article cited in Exercise 11 also gave the following values of the variables y = number of culs-de-sac and z = number of intersections:
(y): 1, 0, 1, 0, 0, 2, 0, 1, 1, 1, 2, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 2, 0, 1, 2, 2, 1, 1, 0, 2, 1, 1, 0, 1, 5, 0, 3, 0, 1, 1, 0, 0
(z): 1, 8, 6, 1, 1, 5, 3, 0, 0, 4, 4, 0, 0, 1, 2, 1, 4, 0, 4, 0, 3, 0, 1, 1, 0, 1, 3, 2, 4, 6, 6, 0, 1, 1, 8, 3, 3, 5, 0, 5, 2, 3, 1, 0, 0, 0, 3
Construct a histogram for the y data. What proportion of these subdivisions had no culs-de-sac? At least one cul-de-sac?
Construct a histogram for the z data. What proportion of these subdivisions had at most five intersections? Fewer than five intersections?
This is the important link for the answer
https://www.chegg.com/homework-help/article-cited-exercise-20-also-gave-following-values-variabl-chapter-1-problem-21e-solution-9780538733526-exc
Explanation / Answer
The R Code is given below:
#First Part
y<-c(1, 0, 1, 0, 0, 2, 0, 1, 1, 1, 2, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 2, 0, 1, 2, 2, 1, 1, 0, 2, 1, 1, 0, 1, 5, 0, 3, 0, 1, 1, 0, 0)
#Histogram
h1<-hist(y)
#Finding frequency
a1<-h$counts
#Finding proportions
length(which(a1==0))/length(a1)
length(which(a1>=1))/length(a1)
#Second Part
z<-c(1, 8, 6, 1, 1, 5, 3, 0, 0, 4, 4, 0, 0, 1, 2, 1, 4, 0, 4, 0, 3, 0, 1, 1, 0, 1, 3, 2, 4, 6, 6, 0, 1, 1, 8, 3, 3, 5, 0, 5, 2, 3, 1, 0, 0, 0, 3)
#Histogram
h2<-hist(z)
#Finding frequency
a2<-h2$counts
#Finding Proportion
length(which(a2<=5))/length(a2)
length(which(a2<5))/length(a2)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.