7

I'd like to search a public repository on github to find where the software defines a given function. It seems this should be straight forward using the advanced search. Not sure if I'm not understanding the filters or if the functions just are not defined.

For example, imagine I want to find where Hadley's facet_wrap function is defined within the ggplot2 repository (it's here.)

I try the advanced search bar selecting Search "Code", written in "R" and enter

facet_wrap repo:ggplot2

And I get no results. Have I formed the query incorrectly?

cboettig
  • 12,377
  • 13
  • 70
  • 113
  • I had so little luck with GitHub's search function I just imported the project into Eclipse and searched using that. – Noumenon Sep 10 '15 at 18:46

1 Answers1

7

You need user/repo as a search term.

facet_wrap repo:hadley/ggplot2

gives 41 results.

kohske
  • 65,572
  • 8
  • 165
  • 155
  • Interesting. The example code I was originally trying to find though doesn't show up this way. Searching for `render_gfm repo:yihui/knitr` [does not give me results](https://github.com/search?type=Code&language=R&q=render_gfm+repo%3Ayihui%2Fknitr&repo=&langOverride=&x=0&y=0&start_value=1), even though I finally [found it](https://github.com/yihui/knitr/blob/master/R/hooks.R) manually. Guess the search isn't fully indexed? – cboettig Feb 22 '12 at 22:37
  • 1
    Yes I think so; knitr is too young for GitHub to build search index. Just tried `saveHTML repo:yihui/animation` and it worked. – Yihui Xie Feb 23 '12 at 02:18