I have 2022.12.0 Build 353 ("Elsbeth Geranium" Release (7d165dcf, 2022-12-03) for Windows). When I pipe any function, it does not show the first argument.
I get why it does this--it's just automatically passing to the first arg. However, I think this is pretty inflexible because I often want to specify the argument anyways or pass to an argument that is NOT the first argument.
I can't see how to go back to the good old autocomplete where it shows me all of the arguments. Please help!!!
For example, if I do the below, the autocomplete offers me just ".f" and not ".x" and ".f"
As you say, piping passes in the first argument. You can't change that. And piping doesn't go anywhere other than the first argument. Maybe just specify the function without piping, then you can give whatever argument you want.
There seem to be multiple issues here. One is whether autocomplete is available for the first argument when something is being piped to it. I think the answer is no. Another is whether the pipe can pass the LHS to something other than the first argument. There is also the difference in the magrittr pipe (%>%) compared to the new base R pipe operator (|>).
The magrittr pipe can use the . placeholder to pass to other arguments and the base pipe uses the _ placeholder, but with limitations. Both of these work fine:
mtcars %>% lm(mpg ~ wt + disp, data = .)
mtcars |> lm(mpg ~ wt + disp, data = _)
Importantly, the base pipe actually passes to the first unnamed argument. If the first argument is named, the LHS will be passed to the next argument. The second argument of lm() is data, so this works:
mtcars |> lm(formula = mpg ~ wt + disp)
The development version of R 4.3.0 also extends the placeholder to subsetting data frames:
I'm glad to hear the development version will allow expressions like _[1:2], and I guess it makes sense that the native pipe will pass to the first unnamed argument. Thank you for your reply. As you mentioned, the other issue is that the user is not provided with the opportunity to autocomplete (or even view) the first argument in a pipe. This means that people will have to look at the tool tip popup as they type the function or look at documentation. RStudio, please do address at your convenience!