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

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Wed Oct 6 21:39:13 CEST 2021


Likely impossible to answer without seeing your  code.

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Oct 6, 2021 at 11:33 AM Gabriel Toro <toro using lettisci.com> wrote:

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

	[[alternative HTML version deleted]]



More information about the R-help mailing list