Search code examples
printingassign

Is there an R function equivalent to wrapping assignment with `()`?


I just discovered that running (y <- 1:4) prints the result in the console, but ...

(y <- 1:4)
# [1] 1 2 3 4

library(dplyr) # for the pipe operator %>% 
y <- 1:4 %>% funct_parenthesis() # DOES IT EXIST ?
# [1] 1 2 3 4

Solution

  • print works

    library(dplyr) # for the pipe operator %>% 
    y <- 1:4 %>% print
    # [1] 1 2 3 4