0

I use code:

z <- filter(dat, Sex=="M" & Diet=="chow") %>% select(Bodyweight) %>% unlist.

And it is written: Error in select(., Bodyweight) : could not find function "select"

Do you know how to fix it? This code was written by professors from Harvard.. Probably I have not installed the appropriate package..

NelsonGon
  • 13,015
  • 7
  • 27
  • 57
Fedor
  • 1
  • 1
  • Sounds like you’re missing `dplyr` / `tidyverse` – Roman Nov 07 '21 at 11:11
  • Does this answer your question? [Error: could not find function ... in R](https://stackoverflow.com/questions/7027288/error-could-not-find-function-in-r) – Nad Pat Nov 07 '21 at 11:18
  • FYI, just in case someone is interested in an alternative, you can do this operation more simply in base R: `z <- dat[dat$Sex == 'M' & dat$Diet == 'chow', 'Bodyweight']` – sashahafner Nov 07 '21 at 11:20

0 Answers0