我需要一种动态将级联数据集转换为普通表格数据集的方法。
方法的条件:
用于生成级联数据集的代码
PhongMaterial { id: material; }
GeometryRenderer {
id: renderer
primitiveType: GeometryRenderer.LineLoop
instanceCount: 1
geometry: Geometry {
attributes: [
Attribute {
name: defaultPositionAttributeName
attributeType: Attribute.VertexAttribute
vertexBaseType: Attribute.Float
vertexSize: 3
byteOffset: 0
byteStride: 3 * 4
count: 6
buffer: Buffer {
type: Buffer.VertexBuffer
data: new Float32Array([
// #1 triangle
-0.9, -0.5, 0.0,
-0.0, -0.5, 0.0,
-0.45, 0.5, 0.0,
// #2 triangle
0.0, -0.5, 0.0,
0.9, -0.5, 0.0,
0.45, 0.5, 0.0,
])
}
}
]
}
}
Entity {
components: [
renderer,
material
]
}
您可以看到如下结构:
我天真的方法,但是每次导入新数据时都无法处理小巧的
DT <- data.table(X__1 = NA,
X__2 = c("A_GROUP","","","","","","","","","",""),
X__3 = c("JOHN","","","","","","","","","",""),
X__4 = c("","RED_TEAM","","GREEN_TEAM","","","","","","",""),
X__5 = c("","MARRY","TOM","PAUL","SAM","","","","",""),
X__6 = c("","","","","","A_LINE","","B_LINE","","C_LINE"),
X__7 = c("","","","","","JAMES","FAN","DEN","JOE","LAW","GEM"))
在这种情况下,我有7列,但有时数据包含9列 是不可预测的。(只有已确认的逻辑是数据的波动幅度为+-2 cols或更小)
有什么有效的方法可以解决那些矛盾吗?