Search code examples
rpiperstudiounexpected-token

New pipe operator |> gives 'unexpected token' flag in RStudio, although the code runs correctly


I want to use the new pipe operator |> in Rstudio, but when I use it in any fashion I get the unexpected token '>' flag. For example, writing

"hi" |> print()

gives me

The code, however, executes alright. Why am I getting that error flag, why is the code executing regardless of it, and what should I do to address this?


Solution

  • You need an updated RStudio version. Make sure you are running the official release with support for the new features in R 4.1 which is version 1.4.1717 (or later). (I think technically you can go back as far as version 1.3.1093 for preview support for the new features, but those were not official releases.)