Hello....wondering if someone can explain the following discrepancy with the number of items in a report. I have the following code which is trying to extract the intercept and slope out of a linear fit that has been applied to a Fit Y by X platform. The issue I see is if the :group column contains just one item then the numplots = 2, and I get an error trying to extract the intercept and slope from rp[1]. I have to extract from rp[2]. If the number of items in the :group column = 2 or higher then numplots = the number of items in the group column and I can extract intercept and slope from rp[1]. In the end, I want to be able to extract all intercepts and slopes for x number of groups where x can be anything from 1 to whatever, but this "feature" makes coding a bit more long winded because I have to treat # groups = 1 different than # goups >= 2.
Clear Globals();
dt = Current Data Table();
bivObj = dt << Bivariate(
Y(:this),
X(:that),
Fit Line,
By(:group),
);
rp = bivObj << Report;
numPlots = nItems(rp1);
intercept = rp[1][OutlineBox("Parameter Estimates")][Columnbox("Estimate")][1];
slope = rp[1][OutlineBox("Parameter Estimates")][Columnbox("Estimate")][1];
thanks