agstudy
agstudy

Reputation: 121618

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

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.

Upvotes: 14

Views: 1131

Answers (2)

Alberto Contador
Alberto Contador

Reputation: 263

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

Upvotes: 0

Ed Fine
Ed Fine

Reputation: 717

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.

Upvotes: 1

Related Questions