I was wondering if there was a way to assign a value and print the value to the console succinctly.
x <- 1:5; x
This is how I would presently do this, but I was wondering if there was a way to do it in one statement.
You can try:
(x <- 1:5)
or
print(x <- 1:5)
though that won't work for things like
(names(x) <- letters[1:5])
though for that specific example you can do:
(x <- setNames(x, letters[1:5]))
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