7

The line of code below from the dplyr package is super simple. And yet, its giving me an error. I'm just trying to practice using the package and want to select a single column, cyl, from the data frame mtcars. What's going on here? Any ideas?

> select(mtcars, cyl)

Error in select(mtcars, cyl) : unused argument (cyl)

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
Mitsugi
  • 77
  • 1
  • 1
  • 5
  • works for me : `select(mtcars, cyl)`. Alternatively, try `mtcars %>% select(cyl)` should give you the same result. – Ronak Shah Jan 09 '18 at 04:31
  • can you post your sessionInfo()? – jrlewi Jan 09 '18 at 04:36
  • 18
    Or most probably you are facing this issue [dplyr::select function clashes with MASS::select](https://stackoverflow.com/questions/24202120/dplyrselect-function-clashes-with-massselect) so maybe use `dplyr::select(mtcars, cyl)`. – Ronak Shah Jan 09 '18 at 04:36
  • yea - that's why I was wondering about the sessionInfo() – jrlewi Jan 09 '18 at 04:39

2 Answers2

6

Came across the same error. Could not figure out what it was. Out of desperation I installed dplyr again and suddenly it worked...

Cul
  • 61
  • 1
  • 2
0

I was having the same issue. It came out that i have not imported dplyr before calling the select method.

Som Dubey
  • 101
  • 1
  • 6