I would like to set the names of my R object and return it in one line. It should look something like:
names(doWork(), c("a", "b", "c"))
And perform the equivalent of:
x <- doWork()
names(x) <- c("a", "b", "c")
x
Is this possible?
You can try setNames
x <- setNames(doWork(), letters[1:3])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With