[R] Strange behavior of 2-d array within function

Gabriel Toro toro @end|ng |rom |ett|@c|@com
Wed Oct 6 20:31:51 CEST 2021


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]]



More information about the R-help mailing list