我写报告的时候,会把数据表嵌入到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 的提示!我知道这样可以解决问题。问题在于我太懒了,保存了很多由图表等生成的代码,其中一些代码包含数据文件的名称。由于我工作速度快,做事马虎,所以经常重新保存。我想我得在完成后仔细检查一下脚本,看看哪些脚本包含文件名。这适用于我研究特定实验的数据。对于我长期使用并可能共享的数据,我认为你建议的解决方案才是我应该采用的。
如果脚本可以修改脚本中的表名,或者以不同的方式解释表名就好了。不过我还没想清楚。可能会引发其他问题……