Skip to content
Prev 396575 / 398502 Next

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

With further fooling around, I realized that explicitly assigning my
last "solution" 'works'; i.e.

names(z)[2] <- "foo"

can be piped as:

 z <- z |>(\(x) "names<-"(x,value = "[<-"(names(x),2,'foo')))()
a foo
1 1   a
2 2   b
3 3   c

This is even awfuller than before. So my query still stands.

-- Bert
On Sat, Jul 20, 2024 at 1:14?PM Bert Gunter <bgunter.4567 at gmail.com> wrote: