Slip 15 - E) Write an R program to extract the five of the levels of factor created from a random sample from the LETTERS

Solution:

L = sample(LETTERS,size=20,replace=TRUE)
print("Original data:")
print(L)
f = factor(L)
print("Original factors:")
print(f)
print("Only five of the levels")
print(table(L[1:5]))

Post a Comment

0 Comments