Subtle |> Pipe Failure with Error: 0 arguments passed (Caused by Non-Breaking Spaces)

Hello everyone,

I just spent a good amount of time debugging an issue with the native R pipe (|>) that I wanted to share, as I'm sure I'm not the last person this will happen to.

I had code that was failing with a confusing error:

# This code FAILED
genes_tpm |>
  names()
Error in `names()`:
! 0 arguments passed to 'names' which requires 1

My first thought was that the native |> pipe didn't support being broken onto a new line, because this worked perfectly:

# This code WORKED
genes_tpm |> names()

This was frustrating, as writing piped operations on multiple lines is critical for readability.

any solution??

Thanks,

Amandeep

This behaviour is likely triggered by a syntax error somewhere in your current file, can be hundreds of lines from your current cursor location. Any issues reported in the PROBLEMS tab ?

There are several related open issues, you can check those few and others linked from those:

Hi there,

Thank you for the reply. the problem still persists, if I start a new Rscript.

Best

Amandeep

Is there any chance that you are loading a .rdata file on startup?

IT's usually a good idea not to have RStudio do an automatic restore.

this is problem with Positron @jrkrideau :slight_smile:

How exactly would you reproduce this?
For me and probably for most other Positron users executing multi-line expressions from editor works fine unless there's a syntax error somewhere:
Positron_8vjIht6XvA