我有兩個數據集。一個是平均每週或每兩週一次的昆蟲計數。另一個是每週測量的產量。我正在嘗試將這兩個數據表結合起來,以便分析昆蟲對產量的影響。
我有這個:

而我正試圖在JMP中製作它。
請注意,對於第44周和第45週,我簡單地移動了收益率值,但是對於第47週,我需要將第46周和第47週的收益率相加。第49周也一樣。對於第52週,我將收益率從50-52週匯總。
我有許多地塊和不均勻的昆蟲和產量取樣週。
感謝您的任何幫助。
這是獲得您想要的一種方法
names default to here(1);
dtInsects = New Table( "Insects",
Add Rows( 10 ),
New Column( "Week",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [39, 40, 41, 42, 43, 44, 45, 47, 49, 52] )
),
New Column( "Plot#",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01]
)
),
New Column( "Insects",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0, 0.2, 0.2, 3.6, 15.4, 2.6, 0.3, 0.3, 0.3, 0.7] )
)
);
dtYields = New Table( "Yields",
Add Rows( 9 ),
New Column( "Week",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [44, 45, 46, 47, 48, 49, 50, 51, 52] )
),
New Column( "Plot#",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01]
)
),
New Column( "Yield",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[130.96, 343.1, 466.2, 903.59, 2611.25, 1052.88, 1335.74, 1414.32,
500.25]
)
)
);
// Join the data
dtTogether = dtInsects << Join(
With( dtYields ),
Merge Same Name Columns,
By Matching Columns( :Week = :Week, :Plot# = :Plot# ),
Drop multiples( 0, 0 ),
Include Nonmatches( 1, 1 ),
Preserve main table order( 0 ),
Output Table( "All Together" )
);
dtTogether << New Column( "Calculated Yield",
formula(
rowNum = Row() - 1;
cumSum = :Yield;
If( Is Missing( :Yield ) == 0,
While( :Match Flag[rowNum] == 2,
cumSum = cumSum + :Yield[rowNum];
rowNum--;
)
);
cumSum;
)
);
// Make formula columns static values
dtTogether:Calculated Yield << delete formula;
// Delete rows that only came from the With Data Table
dtTogether << select where( :Match Flag == 2 ) << delete rows;
// Delete the Match Flag column
dtTogether << delete columns("Match Flag");