In Rstudio's auto complete, how to show the fi

2019-09-21 05:44发布

问题:

It's nice to see that rstudio understands pipes and doesn't display the first argument in autocomplete when using a pipe %>%. But this is causing a trouble with dplyr::mutate. See for example the screen shot below

Sample code:

iris %>% 
    mutate(gsub("a","A",Species))

I would like to see gsub's argument pattern also in the auto-complete suggestion when the cursor is just after gsub(.

回答1:

When you type in the opening parentheses after "gsub", I see the entire method signature pop up like this:

However, when I try the tab autocomplete in the way you suggested, this is what I see:

Your screenshot cut off what I think is a crucial part of the picture here: if you look at the bottom of the argument list, you'll see "Sepal.Length" mentioned. I'm not sure how, but I think the implementation of the piping operator might be responsible. It was only introduced in 2014, so it's not implausible that there are some lingering bugs. If you want to get the most accurate representation of the arguments, I would suggest looking at the pop up (what you see in my first screenshot) instead of the autocomplete list.



回答2:

This has been fixed in more recent versions of RStudio.



标签: r rstudio dplyr