The rocde:
# to call the data
data=state.x77
View(data)
#to count the state greater than 4000k use library(plyr)
library(plyr)
No_of_state_true=count(data[,1]>4000);No_of_state_true
Output is:
> # to call the data
> data=state.x77
> View(data)
> #to count the state greater than 4000k use library(plyr)
> library(plyr)
>
No_of_state_true=count(data[,1]>4000);No_of_state_true
x freq
1 FALSE 32
2 TRUE 18
Thus, the number of states that has a population over 4000 is 18.
Cheers!
Please let me know if you have any confusion. Thanks.
Get Answers For Free
Most questions answered within 1 hours.