我寫報告的時候,我會把資料表嵌入Word文件的zip檔案中,方便以後的讀者擷取資料。每次我準備這麼做的時候,我都會發現自己選的資料表名字太草率了,所以想在儲存到報告之前給它一個好聽的名字。
我遇到的問題是,我一路保存的一些(不是全部)腳本包含資料表的名稱,結果導致軟管腳本停止運作。
有沒有辦法重命名資料表而不會遇到這個問題?
如果您希望將腳本儲存到資料表中,使其更加強大,您可以添加一些 JSL:
//something like this<BR />dt=current data table();
dt<< Distribution(Continuous Distribution( Column( :Protein ) ));
如果您使用的腳本並非保存在資料表中,那麼最好將明確的資料表名稱替換為變量,這樣,即使表名稱發生變化(例如,被附加),腳本也能正常工作。
數據表(“emanon”)是一個明確的表名。
dt=open("emanon.JMP"); 是對錶名的參考。執行 dt 時,結果為:data table("emanon"),但在所有腳本中,結果都只是 dt。
//original script
Data Table( "trends.jmp" ) << Stack(
columns( :Protein, :Purity ),
Drop All Other Columns( 1 ),
Output Table( "Stack of trends (Protein etc.)" )
);
//edit to variable references
<BR />dt=current datatable(); //or some other way to reference the table you're acting on<BR />
dt1=dt<< Stack(
columns( :Protein, :Purity ),
Drop All Other Columns( 1 ),
Output Table( "Stack of trends (Protein etc.)" )
);
although the table name is "Stack of trends (Protein etc.)" the reference for the new table is dt1, which has the added bonus of being much easier to type than the entire table name (that I would misspell and break the script).
感謝 Byron_JMP 的提示!我知道這樣可以解決問題。問題在於我太懶了,保存了很多由圖表等產生的程式碼,其中一些程式碼包含資料檔案的名稱。由於我工作速度快,做事馬虎,所以經常重新保存。我想我得在完成後仔細檢查腳本,看看哪些腳本包含檔案名稱。這適用於我研究特定實驗的數據。對於我長期使用並可能共享的數據,我認為你建議的解決方案是我應該採用的。
如果腳本可以修改腳本中的表名,或以不同的方式解釋表名就好了。不過我還沒想清楚。可能引發其他問題…