When I inherit load of code from people, often I like to see what files call certain functions. A way to do this is to use grep recursively by using the -R option. Say I want to find all the files in which ‘rgamma’ appears.
msl33@hotel Documents]$ grep -R 'rgamma' * 601/lab/4/script4.R:lamda=rgamma(n,shape=5,rate=6) 601/lab/9/9.R:# X[i,]=rgamma 601/lab/9/9.R:# X=matrix(rgamma(length(a)*k,a,1),k,length(a),byrow=T) 601/lab/9/9.R:# theta=rgamma(10000,7,1000) msl33@hotel Documents]$
This will look recursively within files to find appearances of ‘rgamma’. As it turns out rgamma appears once in “script4.R” and thrice in “9.R”.