Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

Following this question, I wish to have some way of counting how many times I am using a package in my daily work.

Is there a function/package to do that?

In case there isn't, how would you construct such a capability?

The way I would do that is by changing it so that at the end of any R session, a log file of the commands would be saved to some location. On that file, I would grep out all instances of "library" and "require". Then save the results into a file (with some time stamp).

Lastly, I might want some function to (once in X time) send this file to a remote FTP location - so that other R users could analyse the results. (is there a way to do that with R ?!)

If someone wants to try and construct such a machanism - I'd be glad to help by providing a relevant FTP account and by spreading the word on it on "R bloggers" for the good of the community.

p.s (mainly for Shane): I wasn't sure if this question should go on stackoverflow or here. If this type of question wasn't debated yet on the meta.stat - it should be. If it was, I'll be glad to know what the conclusion of that discussion was.

share|improve this question
1  
@Tal: I am basically happy to allow any R questions on here, but I just don't see how this has any relevance to the subject of data analysis. This is a meta question about R itself, not even about using R. We'll see what others think, but this seems more appropriate for stackoverflow, r-help, twitter, or a blog post. – Shane Sep 1 '10 at 16:12
Regarding how to do this: I would suggest making your own version of the library function that would track each package when you load it. – Shane Sep 1 '10 at 16:13
Lastly: regarding how to ftp; not sure how to do this from within an R function, but you can do it easily with system("ftp ..."). – Shane Sep 1 '10 at 16:20
1  
If you were looking for gathering data on installed packages, the crantastic package with its function crantastic.submitInstalledPackages would be worth looking at.. – Karsten W. Sep 1 '10 at 17:09
show 5 more comments

closed as off topic by Srikant Vadali, Tal Galili, Shane Sep 1 '10 at 16:59

Questions on Cross Validated are expected to relate to statistics within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

up vote 2 down vote accepted

Overload library() and require() so that they report what they do (whichever way: append to a text file, say) and have those replacement functions loaded first at startup.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.