[Bioc-devel] ClassifyR Fails to Build on Windows

Martin Morgan mtmorgan at fredhutch.org
Sat Jan 17 00:48:16 CET 2015


On 01/16/2015 03:00 PM, Dario Strbenac wrote:
> Thank you for the detailed explanation. I understand the cause now. Actually, the exact problem is that, in runTest, I have a condition that depends on the previous function calls :
>
>   if(any(grepl("runTests", deparse(sys.calls()))))
>
> If runTest was called by runTests, then I intend to return a particular value that does not refer to the variable datasetName. If runTest was called directly by the user, such as when they have one training and on test dataset and don't need to do the cross-validation offered by runTests, I intend to return a ClassifyResult object, which does refer to the variable datasetName. The condition evaluates to FALSE, even when runTest was called by runTests on Windows, and executes the unintended code block which makes reference to datasetName, which is missing. How can I make my check of previously called functions platform-independent when I am also using parallelisation ?
>

I'd just be more direct about signalling what you want runTest to do, by adding 
an extra argument

fun <- function(..., .init=FALSE)
     ## document .init as 'internal' argument not for end users
{
     if (.init)
         return("done")
     message("doing")
     fun(..., .init=TRUE)
}

If you'd like to keep .init from user view, then implement the above as .fun, 
and provide an end-user wrapper

fun <- function(...) .fun(..., .init=FALSE)

Martin

> --------------------------------------
> Dario Strbenac
> PhD Student
> University of Sydney
> Camperdown NSW 2050
> Australia
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioc-devel mailing list