Skip to content
Prev 396576 / 398502 Next

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

?s 21:46 de 20/07/2024, Bert Gunter escreveu:
Hello,

This is not exactly the same but in one of your attempts all you have to 
do is to return x.
The following works and does something.


z |> (\(x){names(x)[2] <- "foo";x})()
#   a foo
# 1 1   a
# 2 2   b
# 3 3   c


Hope this helps,

Rui Barradas