你好,
這似乎是一個非常基本的問題,但我可能使用了錯誤的搜索詞,因為我還沒有找到好的答案。
我有一個腳本,最初我只是製作一個字符串數組(文件路徑),並且可以按順序使用它們而不會出現問題。 隨著範圍的擴大,我現在需要根據同時創建的兩個相同長度的其他數組中的條件進行過濾。 我的大腦仍然在數據表中工作,並且在數據表(或 SQL)格式中這將是一件很容易做到的事情。 創建隱藏數據表可能是一個可行的選擇,但我想更好地理解使用不同的數據結構並更改我的代碼以使用另一個 dt 似乎很混亂。
這看起來像是關聯數組的應用程序,但我正在努力正確創建數組,並且腳本指南和腳本索引並沒有說明問題。 有人可以為我指明正確的方向,或者建議一種對我現在正在嘗試做的事情更有意義的數據結構嗎? 或者隱藏的桌子實際上是最好的選擇?
謝謝你!
Names Default To Here( 1 );
//example data is in dt, my data isn't
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//this is more or less the structure of the data that I have
sex_array = dt:sex << get values;
height_array = dt:height << get values;
weight_array = dt:weight << get values;
//this is what I would do if I had the data in a dt
output = dt:weight[dt << get rows where(and(:age == 13, :sex == "M"))];
show(output);
//how to do this with the data in a structure with no dt? what structure would be appropriate?