Question: Write a single R function that alphabetizes the rows of the data frame creature.data by creature name. There may be more than one way to
Write a single R function that alphabetizes the rows of the data frame creature.data by creature name. There may be more than one way to dothis.
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
