Strange behavior of 2-d array within function
Hi I would print/save iteration number to see at what time this occured and probably traceback() could give you some hint. Alternatively you could make a function from your code see ?function and use debug to trace the error. Without some working example it is impossible to see where is the problem. Cheers Petr
-----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Gabriel Toro Sent: Wednesday, October 6, 2021 8:32 PM To: r-help at r-project.org Subject: [R] Strange behavior of 2-d array within function Hi, I have a function, which defines an array of dimensions 5000 by 60,
calculates
the values within that array and then returns the array on exit. I get an error: Error in my_simulated[ir, 1:it] : incorrect number of
dimensions
For some strange reason, the array is somehow being changed from
mode "numeric" and attributes $dim=6000 by 50
to
mode "list" and attributes NULL
This change occurs at more or less random iterations within a loop (all
within
the same function call). I am not explicitly manipulating the mode or attributes of the array after it is created. I would appreciate any suggestions on what may be causing this problem. I have stared at the code for a long time, run the debugger, etc. Thanks, Gabriel [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.