Skip to content
Prev 396577 / 398502 Next

Using the pipe, |>, syntax with "names<-"

I suspect that you would want to define a function which was aware of 
the limitations of piping to handle this.  For example:

rename <- function(x, col, newname) {
   names(x)[col] <- newname
   x
}

Then

z |> rename(2, "foo")

would be fine.

Duncan Murdoch
On 2024-07-20 4:46 p.m., Bert Gunter wrote: