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.

  • 1
    $\begingroup$ @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. $\endgroup$ – Shane Sep 1 '10 at 16:12
  • $\begingroup$ 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. $\endgroup$ – Shane Sep 1 '10 at 16:13
  • $\begingroup$ Related meta questions: meta.stats.stackexchange.com/questions/1/… and meta.stats.stackexchange.com/questions/169/…. $\endgroup$ – Shane Sep 1 '10 at 16:16
  • $\begingroup$ 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 ..."). $\endgroup$ – Shane Sep 1 '10 at 16:20
  • 1
    $\begingroup$ If you were looking for gathering data on installed packages, the crantastic package with its function crantastic.submitInstalledPackages would be worth looking at.. $\endgroup$ – Karsten W. Sep 1 '10 at 17:09

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.


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