lst <- list(a = 1:3, b = 4:6)
# Without pipe
pick1(lst, "a") # List with one element
pick2(lst, "a") # Just the vector 1:3
# With base R pipe
lst |> pick1("a")
lst |> pick2("a")
df <- data.frame(x = 1:5, y = letters[1:5])
df |> pick1("y") # Returns a data frame with column 'y'
df |> pick2("y") # Returns column 'y' as a character vector
Run the code above in your browser using DataLab