Trying to work out how the new base R pipelines and lambda functions work. I want to generate a matrix with three columns and rename the columns. I thought this would work:
mat1 <- matrix(rnorm(24), ncol = 3) |>
(\(x) colnames(x) <- c("X", "Y", "Z"))()
but it just returns the vector of column names
> mat1
[1] "X" "Y" "Z"
Can anyone explain to me why this doesn't work?