[R] debug package: mtrace fails

deivit david.cassany at transmuralbiotech.com
Tue Jan 24 17:09:03 CET 2012


I'll try,

Here is a piece of code it fails for me, the error I get is always the same,
and it happens in most of my functions. The problem is always the same
trying to execute 'mtrace'.

Thanks!

----------- execution ----------------------

> mtrace(index_remap)
Error in x[[i]] : subscript out of bounds

----------- code -------------------------------

index_remap <- function (idx_relation=NULL, idx_vector=NULL, undo=FALSE)
{
        if ((! any(duplicated(idx_vector))) && all(idx_vector %in%
idx_relation))
        {
                updated_idx <- {}
                for ( i in 1:length(idx_vector) )
                {
                        if (undo == FALSE)
                        {
                                updated_idx <- c(updated_idx, which
(idx_relation == idx_vector[i]))
                        } else {
                                updated_idx <- c(updated_idx,
idx_relation[idx_vector[i]])
                        }
                }

                return (updated_idx)
        } else {
                error_msg("Some error message")
        }
}

error_msg = function ( msg=NULL)
{
        cat(style(msg,fg="red"),"\n")
}



--
View this message in context: http://r.789695.n4.nabble.com/debug-package-mtrace-fails-tp4323546p4324179.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list