not recognizing pipe

the pipe operator is not being recognized even after updating packages. Any help on what I can do about this?

Have you tried loading your library(dplyr)?


In addition to @TFeldens 's suggestion you can also


but in this case dplyr must also be loaded, because the {base} function filter() doesn't work for this.

For simple use, like this, you can also use the built-in pipe operator |> if you are using R 4.1.0 or later. There are some tidy operations where %>% is required instead, but not always.

You can avoid the pipes altogether, as well as dplyr, with

ToothGrowth[ToothGrowth$dose == 0.5 &
            ToothGrowth$len < 10 &
            ToothGrowth$supp == "OJ",]
#>    len supp dose
#> 34 9.7   OJ  0.5
#> 37 8.2   OJ  0.5
#> 38 9.4   OJ  0.5
#> 40 9.7   OJ  0.5

Created on 2023-06-23 with reprex v2.0.2

(Just be careful to include the trailing , at the end.)


Thanks a lot @technocrat

1 Like

This topic was automatically closed 42 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.