你好!
我正在尝试编写一个脚本,将创建子集表和同时重命名子集的列名这两个操作结合起来。
我有一个“主”表,想从中创建 2 个子集。一个子集“子集 1”包含部分列,另一个子集“子集 2”包含其他一些列。
脚本的这一部分运行良好,但如果不运行另一个脚本,我就无法正确重命名子集 1 和子集 2 中的列。
你能帮忙吗?谢谢!
Data Table( "MAIN" ) <<
Subset(
Output Table( "Subset 1" ),
Linked,
Suppress formula evaluation( 0 ),
All rows,
columns(
:"Time 1"n, :"Parameter 1"n
)
);
Data Table( "MAIN" ) <<
Subset(
Output Table( "Subset 2" ),
Linked,
Suppress formula evaluation( 0 ),
All rows,
columns(
:"Time 2"n, :"Parameter 2"n
)
);
dt1 = Open("Subset 1.jmp");
:"Time 1" << Set Name("Time");
dt2 = Open("Subset 2.jmp");
:"Time 2" << Set Name("Time");我认为你可能无法重命名它们,因为你已经链接了子集
Names Default To Here(1);
dt_main = New Table("Untitled",
Add Rows(1),
Compress File When Saved(1),
New Column("Time 1", Numeric, "Continuous", Format("Best", 12), Set Values([1])),
New Column("Parameter 1", Numeric, "Continuous", Format("Best", 12), Set Values([1])),
New Column("Time 2", Numeric, "Continuous", Format("Best", 12), Set Values([2])),
New Column("Parameter 2", Numeric, "Continuous", Format("Best", 12), Set Values([2]))
);
dt_subset1 = dt_main << Subset(
Output Table("Subset 1"),
Linked,
Suppress formula evaluation(0),
All rows,
columns(:"Time 1"n, :"Parameter 1"n)
);
dt_subset2 = dt_main << Subset(
Output Table("Subset 2"),
// Linked,
Suppress formula evaluation(0),
All rows,
columns(:"Time 2"n, :"Parameter 2"n)
);
dt_subset1:"Time 1" << Set Name("Time");
dt_subset2:"Time 2" << Set Name("Time");
在此示例中,您可以看到时间 2 被重命名为时间,但时间 1 没有被重命名。此外,根据您的起始数据以及您最终想要执行的操作,某些堆栈/拆分组合可能在这里很有用。