Question: Use the creature.data data frame for this exercise. Write R Code to extract the waking hours for all creatures using two different R commands. creatures
Use the creature.data data frame for this exercise. Write R Code to extract the waking hours for all creatures using two different R commands.
creatures = c("dog","cat","armadillo","human")
friendly = c(TRUE, TRUE, FALSE, TRUE)
diet = c("anything","mice","termites","pizza")
waking.hours = c(13.9, 11.5, 5.9, 16.0)
creature.data = data.frame(friendly, diet, waking.hours, row.names=creatures)
creatures[creature.data$waking.hours < 12 & !creature.data$friendly]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
