複数の列変数のリストが増加する場合、データフレームに新しい列を追加する必要があります。そうでない場合はR-可変incresesの複数のリスト(列)に基づいてデータフレームに動的に追加する方法
マイデータフレーム)と同じように、その列を保つ、
U_ID Value AD CT value1 Citycode
1 list(`Cno`="50",'cna'="\n\rjhon\n") ia BG list(`Cno`="50") TY
1 list(`Cno`="20",`cna`="guna") AS DB list(`Cno`="\n\r20") UI
2 list(`Cno`="30",`cna`="rt",`cf`="ty") BN FV list(`Cno`="30") GH
2 NULL VF TY NULL TY
3 list(`Cno`="\n\r30") RR TT list(`Cno`="30") ST
私の欲求の出力は、
U_ID Value Cno cna cf AD CT value1 Cno1 Citycode
1 list(`Cno`="50",`cna'="\n\rjhon\n") 50 jhon NULL ia BG list(`Cno1`="50") 50 TY
1 list(`Cno`="20",`cna'="guna") 20 guna NULL AS DB list(`Cno1`="\n\r20") 20 UI
2 list(`Cno`="30",`cna'="rt",`cf'="ty") 30 rt ty BN FV list(`Cno1`="30") 30 GH
2 NULL NULL NULL NULL VF TY NULL NULL TY
3 list(`Cno`="\n\r30") 30 NULL NULL RR TT list(`Cno1`="30") 30 ST
データ、
になりますstructure(list(U_ID = c(1, 1, 2, 2, 3), Value = list(structure(list(
`Cno#` = "50", cna = "\n\rjhon\n"), .Names = c("Cno#", "cna"
)), structure(list(`Cno#` = "50", cna = "guna"), .Names = c("Cno#",
"cna")), structure(list(`Cno#` = "30", cna = "rt", cf = "ty"), .Names = c("Cno#",
"cna", "cf")), "NULL", structure(list(`Cno#` = "\n\r30"), .Names = "Cno#")),
AD = c("ia", "AS", "BN", "VF", "RR"), CT = c("BG", "DB",
"FV", "TY", "TT"), Value1 = list(structure(list(`Cno#` = "50"), .Names = "Cno#"),
structure(list(`Cno#` = "\n\r20"), .Names = "Cno#"),
structure(list(`Cno#` = "30"), .Names = "Cno#"), "NULL",
structure(list(`Cno#` = "30"), .Names = "Cno#")), Citycode = c("TY",
"UI", "GH", "RY", "ST")), .Names = c("U_ID", "Value", "AD",
"CT", "Value1", "Citycode"), row.names = c(NA, -5L), class = "data.frame")
あなたは何を試してみましたか? – Sotos
あなたの投稿の最後のデータは、最初のデータと同じではありません。 –
はい、私は値1のリスト変数に欠けています、col1は正しいです。 –