如何使用命名空间将三个不同的列关联在一起?我有三列数据,我想将每一行彼此关联。 我正在查看名称空间,因为我必须将列表返回到另一个文件。 (假设我可以使用其中的一个单一列表列表来选择数据行)。 如果这不是最好的方法(由于太混乱或更好的方法)。 如何才能实现这一目标?
下面是我到目前为止所得到的,代码仅将两列关联在一起。 我不确定如何关联第三个。 理想情况下,我想将 group2 与 group3 关联起来。
NS = New Namespace();
group1 = column("group1")<<GETASMATRIX></GETASMATRIX>高级统计建模数据混合和清理质量和工艺工程分享和交流结果回复:如何使用命名空间将三个不同的列关联在一起?谢谢你!
回复:如何使用命名空间将三个不同的列关联在一起?只需将该变量设置为函数的最后一行,如下所示:
Names default to here(1);
myfunction = function( {},
dt = Open("$Sample_data/iris.jmp");
NS = New Namespace();
col = {};
col[1] = column(dt, "Sepal Length");
col[2] = column(dt, "Sepal Width");
col[3] = column(dt, "Petal Width");
// if you have JMP 16:
coldata1 = transform each ({c}, col, c << GetasMatrix());
// JMP 15 and older:
coldata2 = {};
for(i=1, i<=n items(col), i++,
coldata2[i] = col[i] << GetasMatrix()
);
// Either way you get the same result:
Show(coldata1 == coldata2);
// Return the list of lists:
coldata1
);
show(myfunction());回复:如何使用命名空间将三个不同的列关联在一起?如果这是在函数中,我如何返回列表? 我不熟悉 JSL 的语法。
回复:如何使用命名空间将三个不同的列关联在一起?这有效 - 谢谢!
回复:如何使用命名空间将三个不同的列关联在一起?我认为您不需要使用名称空间来完成此操作,也许只需构建一个列表列表即可满足您的要求。 这是正确的方向吗?
Names default to here(1);
dt = Open("$Sample_data/iris.jmp");
NS = New Namespace();
col = {};
col[1] = column(dt, "Sepal Length");
col[2] = column(dt, "Sepal Width");
col[3] = column(dt, "Petal Width");
// if you have JMP 16:
coldata1 = transform each ({c}, col, c << GetasMatrix());
// JMP 15 and older:
coldata2 = {};
for(i=1, i<=n items(col), i++,
coldata2[i] = col[i] << GetasMatrix()
);
// Either way you get the same result:
Show(coldata1 == coldata2);
// All data is in one object you can return to another script:
Show(coldata1);