嗨!
我有一個數據集(dt)隨著時間的推移獲得額外的數據;時間段列為列中的天數:已用時間。
我已經獲取了這些數據並將其拆分,以便:經過時間列中的每個新日期在第二個工作表中創建一個新列。經過的天數將隨著時間的推移而增長;所以新工作表中的列數也會增加。我計劃在收集更多數據時重新運行此腳本,以便隨時查看趨勢。
我似乎無法弄清楚如何製作一系列列,顯示各種經過時間和原始時間之間的差異。
//Taking the "dt" table and splitting the elapsed time column up into multiple columns in a new sheet <BR /><BR /><BR />straightness = dt << split(<BR /> Split by (:Elapsed Time ),<BR /> Split (:Straightness ),<BR /> Group (:Rod NUmber ),<BR /> Remaining columns (select (:Rod NUmber | :Type | :Location | :Study) ),<BR /> Output Table ("Straightness")<BR />);<BR /><BR />//Using the hidden "dt" table, we are figuring out which days exist as options in the "elapsed time" column <BR /><BR /><BR />summarize (dt, sample = by (:elapsed time) );
new columns = N Items (sample);<BR />
//In the new spreadsheet, where each of these days is a new column, this "for" loop should generate a new column for each non-zero elapsed time value<BR /> <BR /><BR />for( i=1, i<= new columns, i++, col = num(sample [i]);
straightness<< New Column (sample [i] || " Days", formula (eval(column (13+i+new columns)) - :Name("0"))
);
例如,我目前有三天的數據,所以我有sample = {0,1,2}。我想創建兩個新列,列“1天”和列“2天”,每列包含相應日期的數據減去第0天的數據。
但是隨著我的數據增長並且我有更多的數據,例如sample = {0,1,2,3,4,5},我想要製作5個新列,每個列都有各自的數據和命名方案。
謝謝!!
//Taking the "dt" table and splitting the elapsed time column up into multiple columns in a new sheet
straightness = dt << split( Split by (:Elapsed Time ), Split (:Straightness ), Group (:Rod NUmber ), Remaining columns (select (:Rod NUmber | :Type | :Location | :Study) ), Output Table ("Straightness"));
//Using the hidden "dt" table, we are figuring out which days exist as options in the "elapsed time" column
summarize (dt, sample = by (:elapsed time) );
new columns = N Items (sample);
//In the new spreadsheet, where each of these days is a new column, this "for" loop should generate a new column for each non-zero elapsed time value<BR /><BR />for( i=1, i<= new columns, i++, col = num(sample [i]);
straightness<< New Column (sample [i] || " Days", formula (eval(column (13+i+new columns)) - :Name("0"))
);^^修復了腳本,因為它粘貼了怪異