Open Niagara1000 opened 4 years ago
This code produces the table:
> x <- c("TUE","WED","FRI","SUN")
> vec <- sample( x, 20, replace=TRUE )
> f3 <- factor( vec )
> table( f3 )
f3
FRI SUN TUE WED
5 5 4 6
This table omits MON, THU, and SAT.
Can you re-build the factor so that the table function returns a count of days that exist as well as days that did not occur in the dataset?
It would look similar to the table in Q1-B.
> f2 <- f[ f %in% c("MON","TUE","WED","THUR","FRI") ]
> table( f2 )
f2
FRI MON SAT SUN THUR TUE WED
14 16 0 0 10 10 14
Hi Professor,
I do not understand this question in the Week 2 YellowDig list of questions.
"Q1-C: Counting Zeros
Create a new factor that will report levels that do not occur in a sample.
"
Can you explain each part of the question? I am also confused about how the code is related to the questions.
Thank you, Archana