One way I can think of is putting your loop inside a function (let's say
"func3") and then use:

library(debug)
mtrace(func3)
func3()

# and this at the end:
mtrace.off()

And see the steps...


Tal

----------------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 Thu, Apr 1, 2010 at 7:02 PM, Ayush Raman <ayushra...@gmail.com> wrote:

> Snippet of my code:
>
> library(foreign)
> function1 <- function(y,t){
>
> ###do some matrix operations ##
> }
>
> function2 <- function(y){
>
> y1 = permute(y)
> F1 = function1(y1)
> }
>
> setwd("C:\\Results\\") ## Read Multiple Files
> files.total = list.files()
>
> for (j in files.total){
>    table1 = read.table(j)
>
>    ### do some operations
>    ### Call functions1 and function2
>    ### get the result stored in object result
>
>  message("Result for\t\",j,"\t",result)
>   rm(table1,result) ### in short I am removing all the objects except j and
> function calls -- a crude way of getting the independent results and there
> is no dependency on ###previous results
> }
>
> Now, I would like to verify that it is calculating everything from scratch
> and it is not taking any results from the previous iteration. I am doing
> this because I am not getting the result that I want, also I have verified
> that my code works fine without any errors for the ones when I am reading it
> only once and not multiple times.
>
> Thanks.
>
> Regards,
> Ayush
>
>
>
> On Thu, Apr 1, 2010 at 11:44 AM, Tal Galili <tal.gal...@gmail.com> wrote:
>
>> Hi Ayush,
>> Could you supply with a simple code to try to give an answer on ?
>>
>> Thanks,
>> Tal
>>
>>
>>
>> ----------------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 Thu, Apr 1, 2010 at 6:24 PM, Ayush Raman <ayushra...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I would like to know if there is some debugger in R where I can check
>>> that I
>>> am not using or not doing calculation on my previously stored objects. I
>>> can't use rm (list = ls()) to remove all the objects since I am using a
>>> for
>>> loop for reading 500 files and making making common calculation for each
>>> file, therefore I need to keep the track of my iterator. Is it possible
>>> to
>>> remove everything except the iterator and see that my answers for each
>>> iterations are not getting compiled on previous answers.
>>>
>>> Thanks.
>>>
>>> --
>>> Regards,
>>> Ayush Raman
>>>
>>>        [[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.
>>>
>>
>>
>
>
> --
> Regards,
> Ayush Raman
>
>

        [[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.

Reply via email to