你好,
我正在编写一个脚本来对 json 文件进行解卷积。
进入 jmp 后,结果表由标记为“study.xyz”、“study.cro”、“groups.xyz”、“groups.id”、“test.xyz”、“test.name”等的多组列组成。
我正在尝试为每个组创建一系列表格,例如研究/组/测试。
我有一个脚本,当每个子集单独处理时,效果很好,但由于某些原因,当它移动到下一组时,它会停止创建子集表。
我可以移动处理这些组的顺序以及要“子集化”的第一个组。
换句话说,如果我尝试首先对“研究”进行子集化,则不会处理“组”
如果我将专用于“组”的脚本部分移到第一个位置,它会得到处理,但“学习”不会。
我很困惑。 任何建议将不胜感激。
最好的,
塞巴斯蒂安
try(data table("P0_json")<<CLOSE window=""></CLOSE>这是脚本:
@蒂埃里_S已经回答了你原来的问题。 这是一个不同的答案,可能会避免编写任何 JSL。
您可以使用 JSON 向导获取所需的表,假设您的数据类似于以下内容:
One way to represent your data in JSONOne way to represent your data in JSON以 JSON 表示数据的一种方法
在向导中打开:
Guess and stack to get the first viewGuess and stack to get the first view猜测并堆叠以获得第一个视图
记得叠起来!
Choose what JSON tags generate rows in the JMP tableChoose what JSON tags generate rows in the JMP table选择哪些 JSON 标签在 JMP 表中生成行
说明:向导读取 JSON 文本,扫描标签。 标签检查为排导致将一行添加到表中。 标签检查为坳添加列。
节点显示 JSON 中文本的嵌套。
Select the columns you don't want (easy on the column headers at the bottom) then pick No ColumnSelect the columns you don't want (easy on the column headers at the bottom) then pick No Column选择您不需要的列(很容易选择底部的列标题),然后选择“无列”
您可以在表格预览中选择列,或者在预览上方的 GUI 中一次选择一个列,或者在节点树。 “无列”适用于所有选定的列。
At this point you might also uncheck Groups as a row generator. I forgot, and it made no difference this time. Depends on the JSON organization.At this point you might also uncheck Groups as a row generator. I forgot, and it made no difference this time. Depends on the JSON organization.此时,您还可以取消选中“组作为行生成器”。 我忘了,这次也没什么区别。 取决于 JSON 组织。
单击“确定”
The resulting table's Source script can be re-run to open the table againThe resulting table's Source script can be re-run to open the table again可以重新运行生成的表的源脚本以再次打开该表
对另一张表重复上述操作
Repeat the process to get the other table. Uncheck the study row to remove a blank row from the JMP table.Repeat the process to get the other table. Uncheck the study row to remove a blank row from the JMP table.重复该过程以获得另一张表。 取消选中研究行可从 JMP 表中删除空白行。
附上我使用的 JSON,你的可能有点不同,所以步骤可能有点不同。 您还可以重命名列(列名称字段),但我认为它们已经是您想要的。
你好,
我花了一些时间来调试,但主要问题是您没有指向第一个子集之后的原始表。 另外,您使用 Col_List 变量引用列,这可能会产生奇怪的结果:我用更标准的“Column (, )”替换这些调用。
这是更新后的脚本
Names default to Here (1);
try(data table("P0_json")<<CLOSE window=""></CLOSE>