A user kept track of commuting time of 10 days as the following17, 16, 20, 24, 22 ,15 ,21 ,15 ,17, 22.Now he wants to find how many times he commuted 20 minutes or more and what percent of his commutes are less than 17 minutes.How to do that in R?

513    Asked by Amitjaisawal in Data Science , Asked on Nov 3, 2019
Answered by Amit jaisawal

Let us assign all the recorded time in a variable

x=c(17,16,20,24,22,15,21,15,17,22)

To find out the time he commuted 20 minutes or more, we can do the following

sum(x>=20)

To find out the percentage of his commute less than 17 minutes, we can do the following

y=sum(x

y/length(x)



Your Answer

Interviews

Parent Categories