Efficient and recursive way to navigate through R code on Rstudio?

霸气de小男生 提交于 2019-12-06 18:24:25

问题


I am using RStudio.

I'm starting to feel the need to go through packges code to deeper understanding or hack certains functions. When I try to navigate using Using Ctrl+Click with the mouse For functions defined within packages the code is displayed in a special Source Viewer.

The problem of this view

  1. It is read only view(why?). You can't go to through the code of functions called and defined else. I know other IDE (for other languages) where we can go through the code recursively in read only-mode.
  2. For generic function , we have only the UseMethod line without the code.

My solution was is to load the package(code source) and to go through the code using the Find in files option.

Do you have more efficient method to go respectively through the code? I am open to suggestions: other IDE? Windows/unix? network solution: Do you think it is possible to install Rstudio server version on the cloud to go through all R package without loading?

PS : My question is mainly about going through the code not hacking it.


回答1:


I generally find github to be the best way to dig into packages (for those posted there). While this is far from a perfect solution, it often also includes the tests and links to additional documentation that you don't always find with the standard "?". This approach is generally most useful if you need to truly grok a package, rather than simply understanding a poorly documented signature. Hadley Wickham's lubridate is a package where this approach paid off for me. Additionally, I find I get a better sense of the quality of the code from examining the tests and ancillary files.




回答2:


Put the cursor on the function and press 'F2'. This is equivalent to the 'F3' of Eclipse



来源:https://stackoverflow.com/questions/13677435/efficient-and-recursive-way-to-navigate-through-r-code-on-rstudio

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!