如何通过相同的列名改变下面的数据框:
A.Number A.Name B.Number B.Name A.Number A.Name B.Number B.Name C.D.Age
1 123 Test 456 Test1 789 Test2 101112 Test3 101
To:
A.Number A.Name B.Number B.Name C.D.Age
1 123 Test 456 Test1 NA
2 789 Test2 101112 Test3 101
编辑:我从一个名为dataList
的列表中获得了数据框,如果我运行dput(dataList)
,我会得到...
list(list(A = list(Number = list("123"), Name = list("Test")),
B = list(Number = list("456"), Name = list("Test1"))), list(
A = list(Number = list("789"), Name = list("Test2")), B = list(
Number = list("101112"), Name = list("Test3")), C = list(
D = list(Age = list("101")))))
那么我该如何转换为上述输出?