Displaying 1 result from an estimated 1 matches for "column_renam".
Did you mean:
column_rename
2024 Jul 21
2
[External] Using the pipe, |>, syntax with "names<-"
The main challenge in Bert's original problem is that `[` and `[<-` cannot
be called in a pipeline. The obvious solution is to define named versions,
e.g.:
elt <- `[`
`elt<-` <- `[<-`
Then,
> z <- data.frame(a = 1:3, b = letters[1:3])
> z |> names() |> elt(2)
[1] "b"
> z |> names() |> elt(2) <- "foo"
> z
a foo
1 1 a
2 2