Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
513 views
in Technique[技术] by (71.8m points)

r - In Rstudio's auto complete, how to show the first argument of a function when using dplyr::mutate?

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))

enter image description here

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

enter image description here

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

enter image description here

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...