0

Upon runing this code,

Attrition_edufield <- myds %>%
select(Attrition, EducationField) %>%
group_by(Attrition, EducationField) %>%
summarize(count = n())

I get response with

Error in select(., Attrition, EducationField) : unused arguments (Attrition, EducationField)

Any idea why this occurs?

tyluRp
  • 4,678
  • 2
  • 17
  • 36
Jha Ayush
  • 67
  • 8

2 Answers2

1

You are trying to use dplyr's select; however it appears that you have loaded another package that also defines a select function after loading dplyr and thus masking the one from dplyr.

Restart your R session, and load all the packages you use, while keeping an eye out for messages.

Try specifying the namescope by calling

Attrition_edufield <- myds %>%
  dplyr::select(Attrition, EducationField) %>%  # that's dplyr with two colons in front
  group_by(Attrition, EducationField) %>%
  summarize(count = n())

As an alternative, check that your variable myds is a data.frame (or related structure) and contains the columns you are trying to select.

MrGumble
  • 5,631
  • 1
  • 18
  • 33
0

Some packages 'mask' certain objects from other packages. For instance if you call library(dplyr) then library(clusterSim) you'll get a message: 'The following object is masked from ‘package:dplyr’: select'. There may be another way to get around it but at first you may want to run your dplyr commands and then call the other packages which mess with it.