Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. data(ChickWeight)
  2. glimpse(ChickWeight)
  3.  
  4. ChickWeight$Time <- ifelse(ChickWeight$Time >= 10,1,0)
  5. ChickWeight <- ChickWeight %>% mutate(weight_group = ntile(weight, 3))
  6.  
  7. ChickWeight$Diet <- as.factor(ChickWeight$Diet)
  8. ChickWeight$Time <- as.factor(ChickWeight$Time)
  9. ChickWeight$weight_group <- as.factor(ChickWeight$weight_group)
  10.  
  11.  
  12. table(ChickWeight$Diet, ChickWeight$Time, ChickWeight$weight_group)
  13.  
  14. ggplot(data = ChickWeight, aes(x=Time, y=Diet, fill=weight_group)) +
  15. geom_tile()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement