How to unlist list column and add new column from unlist column value in data frame.Can you please find my df below.
My data Frame.
Status AuditResult Deship Item
Active list(DDID=c("2","First"),Dvalue=c("Bpin","67")) list(UserID=1,Add="Stet,Bpin") list(Menu=1,Bill=9,Deship =list(list(IDesc ="A",vendor=5)))
Inactive list(DDID=c("Second","8"),Dvalue=c("CA","98")) list(UserID=2,Add="Stet,Bpin") list(Menu=1,Bill=8,Deship =list(list(IDesc ="B,N,O",vendor=4)))
OnHold list(DDID=c("78","8",NA),Dvalue=c("UK","76")) list(UserID=1,Add="Stet,Bpin") list(Menu=1,Bill=7,Deship =list(list(IDesc ="L,q",vendor=2)))
Expected data frame.
Status DDID Dvalue UserID Add Menu Bill IDesc vendor
Active "2","First" "Bpin","67" 1 "Stet,Bpin" 1 9 "A" 5
Inactive "Second","8" "CA","98" 2 "Stet,Bpin" 1 8 "B,N,O" 4
OnHold "78","8",NA "UK","76" 1 "Stet,Bpin" 1 7 "L,q" 2
please suggest me if any unstructured code.
Dput.
structure(list(Status = c("Active", "Inactive", "OnHold"), AuditResult = list(
structure(list(DDID = c(2, "First"), Dvalue = c("Bpin",
67)), .Names = c("DDID", "Dvalue"), class = "data.frame", row.names = 1:2),
structure(list(DDID = c("Second", 8), Dvalue = c("CA",
98)), .Names = c("DDID", "Dvalue"), class = "data.frame", row.names = 1:2),
structure(list(DDID = c("78","8",NA), Dvalue = c("UK",
76)), .Names = c("DDID", "Dvalue"), class = "data.frame", row.names = 1:2)),
Deship = list(structure(list(UserID = 1, Add = "Stet, Bpin"), .Names = c("UserID",
"Add"), class = "data.frame", row.names = 1L), structure(list(
UserID = 2, Add = "Stet, Bpin"), .Names = c("UserID",
"Add"), class = "data.frame", row.names = 1L), structure(list(
UserID = 1, Add = "Stet, Bpin"), .Names = c("UserID",
"Add"), class = "data.frame", row.names = 1L)), Item = list(
structure(list(Menu = 1, Bill = 9.0, Deship = list(
structure(list(IDesc = "A", vendor = 5), .Names = c("IDesc",
"vendor"), class = "data.frame", row.names = 1L))), .Names = c("Menu",
"Bill", "Deship"), class = "data.frame", row.names = 1L),
structure(list(Menu = 1, Bill = 8.0, Deship = list(
structure(list(IDesc = "B,N,O", vendor = 4), .Names = c("IDesc",
"vendor"), class = "data.frame", row.names = 1L))), .Names = c("Menu",
"Bill", "Deship"), class = "data.frame", row.names = 1L),
structure(list(Menu = 1, Bill = 7.0, Deship = list(
structure(list(IDesc = "L,q", vendor = 2), .Names = c("IDesc",
"vendor"), class = "data.frame", row.names = 1L))), .Names = c("Menu",
"Bill", "Deship"), class = "data.frame", row.names = 1L))), .Names = c("Status",
"AuditResult", "Deship", "Item"), row.names = c(NA,
3L), class = "data.frame")
See Question&Answers more detail:
os