Need urgent assistance

I run that select function, that is the error I am getting back. please I need help

penguins %>%
  • select(species)
    Error:
    ! [conflicted] select found in 2 packages.
    Either pick the one you want with :::
    • dplyr::select
    • MASS::select
    Or declare a preference with conflicts_prefer():
    • conflicts_prefer(dplyr::select)
    • conflicts_prefer(MASS::select)
    Run rlang::last_trace() to see where the error occurred.

You seem to have two packages,{dplyr} and {MASS} loaded. Each package has a function namet select. You simply need to specify which one you want to use.

As the message says

dplyr::select()

will allow you to use the {dplyr} function and

MASS::select()

allows you to use the {MASS} function.

Can you supply us with the rest of your code? We can probably see from it which command you want.

1 Like

See R Packages (2e) for more background on how R handles this – usually load order of the packages.

You need to specify which select() function you want to use. Since you're working with the penguins dataset and likely want to use dplyr's select(), you can do one of the following:

Option 1: Use the dplyr::select() directly

You can tell R explicitly to use select() from the dplyr package by adding dplyr:: before the function name.

penguins %>%
dplyr::select(species)

Option 2: Set a preference for dplyr::select()

If you frequently use dplyr::select() and want to avoid this conflict in future commands, you can set a preference using the conflicts_prefer() function:

conflicts_prefer(dplyr::select)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.