rBatt / trawl

Analysis of scientific trawl surveys of bottom-dwelling marine organisms
1 stars 0 forks source link

bug in expand.data? #23

Closed rBatt closed 9 years ago

rBatt commented 9 years ago

see new notes at 693be1134fd70efb8f726022b001ac336b8463d4

could just be an issue with the labeling of the dimensions in the array output, or could be an issue with the order in which the array is filled

actually, i think i know what the problem is

It is the key of expD, which affects the ordering of expD's rows. When expD[,value] begins to fill the array, expD needs to be ordered according to the dimensions of the array, specifically, setorder(expD, stratum, K, spp); note that I don't think it has to be setorder(expD, s.reg, year, stratum, K, spp) because s.reg and year are already in the by= statement when the array is being filled (well, list of arrays), so that subset happens, ergo the ordering for those columns would not matter. Currently, in this particular case, expD is explicitly ordered to s.reg, year, K, and then some residual ordering from past steps. Because stratum has to take precedent over K in the ordering, this would guarantee that expD was not properly ordered when it fills the output array.

I think that's the fix.