[R] dead code removal
paul.hiemstra at knmi.nl
Tue Jul 19 13:14:25 CEST 2011
On 07/19/2011 09:57 AM, Juan Carlos Borrás wrote:
> Ideally you'd have the next two items available:
> - tests that ensure that your code carries out what it should and as it should.
> - a coverage analysis tool that reports what parts of your code have
> been and have not been executed by your tests above.
> Neither of those are mandatory though, but they will save you from
> nightmares later on.
> While there are a few tests harnesses for doing the former (i.e.
> RUnit, test_that and so on...), I am not aware of any code coverage
> tools for R, sadly.
Maybe you could profile your code and record which functions are used.
For an example of how to do this see . Cross-referencing them with
your code should indicate if there are any functions that are unused.
> On Tue, Jul 19, 2011 at 9:51 AM, Alex Bird <sunduck at gmail.com> wrote:
>> Hi there,
>> I have some unused code in my project but have no idea how to clean
>> it up in some kind of automatic way.
>> Maybe there are some tools/ways to identify and remove/mark dead
>> parts of the code?
>> Thanks in advance!
>> Kind regards,
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494
More information about the R-help