Re: [R] debug package: mtrace fails

2012-01-24 Thread Tal Galili
Hi Deivit,
Can you offer a self contained example of r code when the function fails
for you?


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Tue, Jan 24, 2012 at 1:40 PM, deivit david.cass...@transmuralbiotech.com
 wrote:

 Hi all,

 Since three month ago I started working with R professionally, I never did
 it before, so I am such a newbie.
 I am having some problems using the 'debug' package. I love this package,
 but most of the times I wanna use it it just fails :P

 When typing at prompt 'mtrace(myfunct)' most of the times I get the
 following error:
 Error in x[[i]] : subscript out of bounds

 I can't understand whats happening and I couldn't find any help surfing the
 net. I have the feeling it might be because of my coding style or something
 similar.

 Any help will be highly appreciated :)

 Thanks in advance!
 see ya


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

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] debug package: mtrace fails

2012-01-24 Thread deivit
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.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.