Message-ID: <64B21EB8-28D4-43A3-96FA-497F8DBBEB76@temple.edu>
Date: 2024-07-20T22:35:20Z
From: Richard M. Heiberger
Subject: [External] Using the pipe, |>, syntax with "names<-"
In-Reply-To: <7be52826-1922-4e11-bcb5-57c9dc721ebd@gmail.com>
I think Iris's solution should be added to the help file: ?|>
there are no examples there now that show assignment or replacement using the "_"
> On Jul 20, 2024, at 18:21, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>
> On 2024-07-20 6:02 p.m., Iris Simmons wrote:
>> z <- data.frame(a = 1:3, b = letters[1:3])
>> z |> names() |> _[2] <- "foo"
>> z
>
> That's a great suggestion!
>
> Duncan Murdoch
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.r-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.