Unexpected token showing when using new base R pipe and function syntax

This seems to be a bug when I open a script that uses "" instead of "function" and "|>" instead of "%>%".

I have the latest version of R installed, so it doesn't seem to be a matter of updating.

Here is the example, and when I hover over the red circular x's it says, "unexpected token '>'":

When I try to run the script, it seems to recognize these symbols and there are no errors. It just seems like some sort of bug where it's flagging these unexpected symbols but when running they are recognized. Not sure how to fix this bug? Or if it's just a matter of redownloading RStudio?


What version of RStudio you have installed (this not the same as your R version)? Very likely you need to update RStudio to a version that supports the native pipe (relatively new R feature).