3.Given a vector of numerical values, find the most common element (mode) for it. Report only the element and the number of its occurrences. For example, use num <- sample(100, rep=T) to generate (with replacement) a list of random integers from 1 to 100.
Num <- sample(50:200,rep=T)
sort(table(Num),dec=T)[1:5]
Num
116 69 53 135 143
7 5 4 4 4
5.An instructor has 12 students is his class: Amy, Brad, Chad, Daisy, Ed, Fey, George, Hillary, Ike, Jane, Kim, Luke. For a class assignment, he needs to permute these names at random. Help him accomplish it with R.
Names <- c("Amy","Brad","Chad","Daisy","Ed","Fey","George","Hillary","Ike","Jane","Kim","Luke")
print(RN <- sample(Names,replace = F))
[1] "Ed" "Chad" "Daisy" "Brad" "George" "Jane" "Amy"
[8] "Hillary" "Luke" "Kim" "Fey" "Ike"