如何在R中拆除具有列表列的数据帧

如何在R中拆除具有列表列的数据帧,r,R,我有这个数据帧(test),它有100个地址+计数+地名: structure(list(Address = c("1200 BROOKS AV, Rochester", "35 GLENDALE PK, Rochester", "LAKE AV/W RIDGE RD, Rochester", "271 GREECE RIDGE CENTER DR, Greece", "DEWEY AV/W RIDGE RD, Rochester", "LONG POND RD/W RIDGE RD, Gr

我有这个数据帧(
test
),它有100个地址+计数+
地名

structure(list(Address = c("1200 BROOKS AV, Rochester", "35 GLENDALE PK, Rochester", 
"LAKE AV/W RIDGE RD, Rochester", "271 GREECE RIDGE CENTER DR, Greece", 
"DEWEY AV/W RIDGE RD, Rochester", "LONG POND RD/W RIDGE RD, Greece", 
"E HENRIETTA RD/JEFFERSON RD, Henrietta", "PENFIELD RD/RT 250, Penfield", 
"2150 CHILI AV, Gates", "DRIVING PARK AV/LAKE AV, Rochester", 
"WB RT 490 AT RT 390, Gates", "1490 HUDSON AV, Rochester", "NB RT 590 AT EMPIRE BL, Irondequoit", 
"SB RT 590 AT EMPIRE BL, Irondequoit", "3349 MONROE AV, Pittsford", 
"2833 W RIDGE RD, Greece", "LYELL AV/MT READ BL, Rochester", 
"W HENRIETTA RD/JEFFERSON RD, Henrietta", "WB RT 490 AT RT 590, Brighton", 
"LONG POND RD/RIDGEWAY AV, Greece", "525 TITUS AV, Irondequoit", 
"LATTA RD/LONG POND RD, Greece", "00 RT 104, Webster", "LEXINGTON AV/MT READ BL, Rochester", 
"SB RT 590 AT BROWNCROFT BL, Rochester", "1750 EAST AV, Rochester", 
"WB RT 490 AT MT READ BL, Rochester", "HUDSON AV/E RIDGE RD, Irondequoit", 
"1200 MARKETPLACE DR, Henrietta", "59 GLEN RD, Brighton", "1555 LONG POND RD, Greece", 
"1425 PORTLAND AV, Rochester", "900 HOLT RD, Webster", "ON W RIDGE RD AT RT 390, Greece", 
"NB RT 390 AT CHILI AV, Gates", "CLOVER ST/MONROE AV, Brighton", 
"CULVER RD/E RIDGE RD, Irondequoit", "EB RT 490 AT RT 390, Gates", 
"00 RT 104, Irondequoit", "ELMWOOD AV/MT HOPE AV, Rochester", 
"3333 W HENRIETTA RD, Henrietta", "ON E HENRIETTA RD AT RT 390, Brighton", 
"2301 LYELL AV, Gates", "SB RT 590 AT MONROE AV, Brighton", "1341 WESTFALL RD, Brighton", 
"3800 DEWEY AV, Greece", "EB RT 104 AT BAY BRIDGE, Irondequoit", 
"NB RT 390 AT RT 490, Gates", "NB RT 590 AT RT 490, Rochester", 
"SB RT 590 AT RT 490, Rochester", "EB RT 490 AT RT 590, Rochester", 
"NB RT 390 AT SCOTTSVILLE RD, Chili", "FETZNER RD/W RIDGE RD, Greece", 
"EB RT 490 AT MT READ BL, Rochester", "NB RT 590 AT MONROE AV, Brighton", 
"3195 MONROE AV, Pittsford", "NB RT 590 AT BROWNCROFT BL, Brighton", 
"SB RT 390 AT RT 490, Gates", "ON N GOODMAN ST AT RT 104, Irondequoit", 
"BRIGHTON HENRTA T L RD/W HENRIETTA RD,", "SB RT 390 AT BROOKS AV, Gates", 
"SB RT 390 AT LYELL AV, Gates", "1000 E HENRIETTA RD, Brighton", 
"LAKE AV/RIDGEWAY AV, Rochester", "JEFFERSON RD/S WINTON RD, Henrietta", 
"EB RT 490 AT S GOODMAN ST, Rochester", "601 ELMWOOD AV, Rochester", 
"MAIDEN LA/MT READ BL, Greece", "NB RT 390 AT LYELL AV, Gates", 
"630 N CLINTON AV, Rochester", "EB RT 490 AT CULVER RD, Rochester", 
"MT READ BL/RIDGEWAY AV, Rochester", "EB RT 104 AT N GOODMAN ST, Irondequoit", 
"ST PAUL ST/UPPER FALLS BL, Rochester", "NB RT 390 AT W RIDGE RD, Greece", 
"EMPIRE BL/PLANK RD, Penfield", "WB RT 104 AT BAY BRIDGE, Webster", 
"DEWEY AV/STONE RD, Greece", "NB RT 390 AT LEXINGTON AV, Gates", 
"SB RT 390 AT CHILI AV, Gates", "EB RT 104 AT BAY RD, Webster", 
"CLIFFORD AV/PORTLAND AV, Rochester", "NB RT 390 AT BROOKS AV, Gates", 
"N CLINTON AV/UPPER FALLS BL, Rochester", "WB RT 490 AT BUSHNELL BASIN EXIT, Perinton", 
"SB RT 390 AT LEXINGTON AV, Gates", "WB RT 490 AT RT 531, Gates", 
"CLOVER ST/W JEFFERSON RD, Pittsford", "JEFFERSON RD/E RIVER RD, Henrietta", 
"SB RT 390 AT SCOTTSVILLE RD, Chili", "LINDEN AV/RT 441, Pittsford", 
"AYRAULT RD/TURK HILL RD, Perinton", "1000 RIDGE RD, Webster", 
"WB RT 104 AT N GOODMAN ST, Irondequoit", "1955 EMPIRE BL, Penfield", 
"NB RT 390 AT VINTAGE LA, Greece", "EB RT 490 AT INNER LP, Rochester", 
"W HENRIETTA RD/LEHIGH STATION RD, Henrietta", "FIVE MILE LINE RD/RIDGE RD, Webster", 
"N GOODMAN ST/E MAIN ST, Rochester"), Count = c(5579L, 1440L, 
1141L, 1059L, 1015L, 924L, 851L, 836L, 825L, 808L, 798L, 785L, 
749L, 748L, 744L, 741L, 734L, 708L, 704L, 699L, 676L, 672L, 670L, 
670L, 668L, 667L, 663L, 661L, 643L, 642L, 641L, 629L, 621L, 619L, 
617L, 615L, 611L, 610L, 606L, 605L, 603L, 594L, 585L, 582L, 573L, 
571L, 564L, 557L, 555L, 554L, 553L, 553L, 552L, 551L, 551L, 550L, 
548L, 540L, 533L, 532L, 531L, 524L, 523L, 523L, 522L, 518L, 517L, 
512L, 505L, 503L, 497L, 492L, 491L, 490L, 488L, 481L, 478L, 476L, 
475L, 475L, 473L, 470L, 470L, 467L, 465L, 461L, 460L, 459L, 459L, 
457L, 456L, 450L, 447L, 446L, 445L, 442L, 437L, 436L, 435L, 434L
), place_names = list(structure(list(name = c("Rochester", "Dunkin'"
)), class = "data.frame", row.names = 1:2), structure(list(name = c("Rochester", 
"Edgerton")), class = "data.frame", row.names = 1:2), structure(list(
    name = c("55 W Ridge Rd", "Rochester")), class = "data.frame", row.names = 1:2), 
    structure(list(name = c("Greece", "Bath & Body Works", "Metro by T-Mobile", 
    "Hickory Farms")), class = "data.frame", row.names = c(NA, 
    4L)), structure(list(name = c("West Ridge Road", "Rochester"
    )), class = "data.frame", row.names = 1:2), structure(list(
        name = c("2563-2537 W Ridge Rd", "Greece")), class = "data.frame", row.names = 1:2), 
    structure(list(name = "East Henrietta Road"), class = "data.frame", row.names = 1L), 
    structure(list(name = c("Penfield Road", "Events by Jen")), class = "data.frame", row.names = 1:2), 
    structure(list(name = c("Gates", "Jackson Hewitt Tax Service", 
    "Dunkin'", "Regal Nails Salon & Spa", "Walmart Bakery", "TNT Fireworks"
    )), class = "data.frame", row.names = c(NA, 6L)), structure(list(
        name = c("Lake Avenue", "Rochester")), class = "data.frame", row.names = 1:2), 
    "No Match", structure(list(name = c("Rochester", "Walmart Supercenter", 
    "Jackson Hewitt Tax Service", "West Irondequoit")), class = "data.frame", row.names = c(NA, 
    4L)), "No Match", "No Match", structure(list(name = c("Barnes & Noble", 
    "Trader Joe's", "Michaels", "Block Advisors", "Orvis", "Pittsford Plaza", 
    "Matrix Security Services, Inc.", "Next Revolution Strategies L.L.C.", 
    "Michael Nelkin - Citizens Bank, Home Mortgages", "uBreakiFix (Coming Soon)", 
    "Davide Turco: Allstate Insurance", "Elite Tailor Inc.")), class = "data.frame", row.names = c(NA, 
    12L)), structure(list(name = c("Greece", "Citizens Bank", 
    "Four Seasons Spirits & Wine", "Hearing Help", "Leap N' Laugh", 
    "Spirit Halloween", "Campbell Services, LLC", "Wegmans Bakery", 
    "HomeGoods", "Wegmans Sub Shop")), class = "data.frame", row.names = c(NA, 
    10L)), structure(list(name = c("1274-1308 Lyell Ave", "Rochester"
    )), class = "data.frame", row.names = 1:2), structure(list(
        name = "Dunn Tire"), class = "data.frame", row.names = 1L), 
    structure(list(name = c("New York 590", "Irondequoit")), class = "data.frame", row.names = 1:2), 
    structure(list(name = c("1620-1600 Long Pond Rd", "Long Pond & Ridgeway"
    )), class = "data.frame", row.names = 1:2), structure(list(
        name = c("Irondequoit", "Big Lots", "Little Caesars Pizza", 
        "KeyBank", "Dollar General", "Wegmans Bakery", "higi", 
        "Wegmans Sub Shop", "Wegmans Catering", "West Irondequoit"
        )), class = "data.frame", row.names = c(NA, 10L)), structure(list(
        name = "3162-3164 NY-18"), class = "data.frame", row.names = 1L), 
    structure(list(name = "Empire Visionworks"), class = "data.frame", row.names = 1L), 
    structure(list(name = c("Mount Read Boulevard", "Rochester"
    )), class = "data.frame", row.names = 1:2), "No Match", structure(list(
        name = c("Rochester", "Helen M. Malahosky, RPH", "Cardtronics", 
        "Paul Taranto, RPH", "Bridget M. Barvian, RPH", "John Crisafulli, RPH", 
        "Barbone Katie E", "Kristin M. Veley, PharmD", "Wegmans Bakery", 
        "Wegmans Pizza", "Dedes Natasha A", "Wegmans Sub Shop", 
        "Wegmans Catering", "East Avenue")), class = "data.frame", row.names = c(NA, 
    14L)), "No Match", structure(list(name = c("661-673 Ridge Rd", 
    "Irondequoit")), class = "data.frame", row.names = 1:2), 
    structure(list(name = c("Jackson Hewitt Tax Service", "Walmart Grocery Pickup and Delivery"
    )), class = "data.frame", row.names = 1:2), structure(list(
        name = "Brighton"), class = "data.frame", row.names = 1L), 
    structure(list(name = c("Timothy R. McCormick Transitional Care Center at Park Ridge Living Center", 
    "Unity Hospital - Emergency Center", "Unity Cardiology Group", 
    "Golisano Restorative Neurology & Rehabilitation Center", 
    "L. M. Salmen Surgical Center", "Unity Hospital - Intensive Care Unit", 
    "Andrew J. Kirch Dialysis Center - Park Ridge", "Charles J. August Joint Replacement Center", 
    "Unity Hospital", "Lipson Cancer Institute - Unity Hospital", 
    "Imaging Center - Unity Hospital", "The Sands-Constellation Heart Institute - Unity Hospital", 
    "Women's Continence Center Of Greater Rochester - West Side"
    )), class = "data.frame", row.names = c(NA, 13L)), structure(list(
        name = c("Rochester", "Laboratory Service Center - Rochester General Hospital", 
        "Imelda C MacDonald, MD", "Hyun Jin Yoo, MD", "Hassan Jamil, DO", 
        "James Patrick Cullinan, DO", "Jane Laura Kjoller, MD", 
        "Group 14621")), class = "data.frame", row.names = c(NA, 
    8L)), structure(list(name = c("Wegmans Bakery", "Wegmans Sub Shop", 
    "Wegmans Catering")), class = "data.frame", row.names = c(NA, 
    3L)), "No Match", "No Match", structure(list(name = c("2876-2866 Monroe Ave", 
    "Brighton")), class = "data.frame", row.names = 1:2), structure(list(
        name = c("2098-2080 Ridge Rd", "Rochester")), class = "data.frame", row.names = 1:2), 
    structure(list(name = "New York 390"), class = "data.frame", row.names = 1L), 
    structure(list(name = c("Irondequoit - Wayne County Expressway", 
    "Irondequoit Bay Bridge", "Bay Bridge")), class = "data.frame", row.names = c(NA, 
    3L)), structure(list(name = c("Mount Hope Avenue", "Rochester"
    )), class = "data.frame", row.names = 1:2), structure(list(
        name = c("JOANN Fabrics and Crafts", "Red Wing", "Dollar Tree", 
        "Payless ShoeSource", "South Town Plaza", "Lina Esther Vega, DDS", 
        "Lisa Kandella, DMD", "Bank of America Mortgage")), class = "data.frame", row.names = c(NA, 
    8L)), structure(list(name = c("Rochester", "DiBella's Subs", 
    "Strong")), class = "data.frame", row.names = c(NA, 3L)), 
    structure(list(name = c("Gates-North Gates", "Wegmans Pizza", 
    "Wegmans Bakery", "Wegmans Sub Shop", "Holiday inn", "Gates"
    )), class = "data.frame", row.names = c(NA, 6L)), "No Match", 
    structure(list(name = "Brighton"), class = "data.frame", row.names = 1L), 
    structure(list(name = c("minuteKEY", "Quick-Tag")), class = "data.frame", row.names = 1:2), 
    structure(list(name = c("Irondequoit - Wayne County Expressway", 
    "Irondequoit Bay Bridge", "Bay Bridge")), class = "data.frame", row.names = c(NA, 
    3L)), "No Match", "No Match", structure(list(name = c("New York 590", 
    "Rochester")), class = "data.frame", row.names = 1:2), "No Match", 
    structure(list(name = c("Chili", "Scottsville-Rt 390 Entrance NB"
    )), class = "data.frame", row.names = 1:2), structure(list(
        name = c("1932 W Ridge Rd", "Greece")), class = "data.frame", row.names = 1:2), 
    structure(list(name = c("Mount Read Boulevard", "Jewelry and Coin Exchange", 
    "Rochester")), class = "data.frame", row.names = c(NA, 3L
    )), "No Match", structure(list(name = c("Cardtronics ATM", 
    "Kara Cilano, RPh", "Emilia Kuczkowski, RPH", "John Coultry, RPH", 
    "Marisa Marchese, Pharm. D.", "Wegmans Sub Shop", "Wegmans Catering", 
    "Wegmans Bakery")), class = "data.frame", row.names = c(NA, 
    8L)), "No Match", "No Match", structure(list(name = c("Irondequoit", 
    "IHOP", "East Irondequoit")), class = "data.frame", row.names = c(NA, 
    3L)), structure(list(name = c("6984-6924 NY-15", "2 Brooktree Terrace Macedon"
    )), class = "data.frame", row.names = 1:2), structure(list(
        name = "New York 390"), class = "data.frame", row.names = 1L), 
    "No Match", structure(list(name = c("Brighton", "Pioneer Hall", 
    "Alexander Hall", "Samuel J. Stabins Physical Education Complex", 
    "CSEA Unit 7402", "M&T Bank ATM")), class = "data.frame", row.names = c(NA, 
    6L)), structure(list(name = c("1470-1492 Lake Ave", "Rochester"
    )), class = "data.frame", row.names = 1:2), structure(list(
        name = "1585-1599 W Jefferson Rd"), class = "data.frame", row.names = 1L), 
    "No Match", structure(list(name = c("Rochester", "UR Medicine Oncology – David Korones, MD", 
    "UR Medicine Oncology – Michelle Shayne, MD", "UR Medicine Oncology – Rabih Salloum, MD", 
    "UR Medicine Oncology – Matthew Miller, MD", "UR Medicine Oncology – Randeep Kashyap, MD", 
    "UR Medicine Oncology – Chunkit Fung, MD", "UR Medicine Oncology – Kristen O'Dwyer, MD", 
    "UR Medicine Oncology – Alissa Huston, MD", "UR Medicine Oncology – Paul van der Sloot, MD", 
    "UR Medicine Oncology – Fergal Fleming, MBBCh", "UR Medicine Oncology – Mark Orloff, MD", 
    "UR Medicine Oncology – Michael Becker, MD", "UR Medicine Oncology – Jane Liesveld, MD", 
    "UR Medicine Heart & Vascular – Peter Knight, MD", "UR Medicine Heart & Vascular – Eugene Storozynsky, MD", 
    "UR Medicine Heart & Vascular – Liz Powley, NP", "UR Medicine Heart & Vascular – Joseph Delehanty, MD", 
    "UR Medicine Heart & Vascular – Spencer Rosero, MD", "Strong"
    )), class = "data.frame", row.names = c(NA, 20L)), structure(list(
        name = "3559-3545 County Rd 150"), class = "data.frame", row.names = 1L), 
    "No Match", structure(list(name = c("Rochester", "Police Department-Patrol Section Office", 
    "Upper Falls")), class = "data.frame", row.names = c(NA, 
    3L)), "No Match", structure(list(name = "1431-1301 County Rd 111"), class = "data.frame", row.names = 1L), 
    "No Match", structure(list(name = c("631-607 St Paul St", 
    "Rochester")), class = "data.frame", row.names = 1:2), "No Match", 
    structure(list(name = "1634-1650 Empire Blvd"), class = "data.frame", row.names = 1L), 
    structure(list(name = c("Irondequoit - Wayne County Expressway", 
    "Irondequoit Bay Bridge", "Bay Bridge")), class = "data.frame", row.names = c(NA, 
    3L)), structure(list(name = "2954-2958 NY-18"), class = "data.frame", row.names = 1L), 
    "No Match", "No Match", "No Match", structure(list(name = c("1176-1156 Clifford Ave", 
    "Rochester")), class = "data.frame", row.names = 1:2), structure(list(
        name = "New York 390"), class = "data.frame", row.names = 1L), 
    structure(list(name = c("663-643 N Clinton Ave", "Rochester"
    )), class = "data.frame", row.names = 1:2), "No Match", structure(list(
        name = c("1735-1761 Massachusetts Ave", "Marihuana Office Delivery", 
        "Lexington")), class = "data.frame", row.names = c(NA, 
    3L)), "No Match", structure(list(name = "2813-2849 NY-65"), class = "data.frame", row.names = 1L), 
    structure(list(name = c("West Jefferson Road", "Brighton"
    )), class = "data.frame", row.names = 1:2), structure(list(
        name = c("Chili", "Scottsville-Rt 390 Exit SB")), class = "data.frame", row.names = 1:2), 
    structure(list(name = "Route 441"), class = "data.frame", row.names = 1L), 
    structure(list(name = "Turk Hill Road"), class = "data.frame", row.names = 1L), 
    "No Match", "No Match", structure(list(name = c("Wegmans Bakery", 
    "Jill Graham, RPh", "Christine Ling, RPH", "Eve Blake, LCSW", 
    "Maria Fatiga, PharmD", "Wegmans Sub Shop", "Julie Taylor, RPH", 
    "Shannon Kozarits, RPH", "Wegmans Catering")), class = "data.frame", row.names = c(NA, 
    9L)), structure(list(name = "New York 390"), class = "data.frame", row.names = 1L), 
    "No Match", structure(list(name = c("West Henrietta Road", 
    "Henrietta")), class = "data.frame", row.names = 1:2), structure(list(
        name = "830-828 Ridge Rd"), class = "data.frame", row.names = 1L), 
    structure(list(name = c("1049-1065 E Main St", "Rochester"
    )), class = "data.frame", row.names = 1:2))), class = c("tbl_df", 
"tbl", "data.frame"), row.names = c(NA, -100L))

place\u names
列中,我们有带有
name
列的数据帧和几个表示
地址的名称的值。如何拆除此
名称
列,使
地名
列的第一行为
罗切斯特、邓肯
,第二行为
罗切斯特、埃杰顿
,第三行为
罗切斯特里奇路55号
,等等。

一个选项是将“地名”展平,并在按“地址”分组后将其粘贴在一起

library(tidyverse)
test %>%
  group_by(Address) %>%
  summarise(name = toString(flatten_chr(flatten(place_names))))
# A tibble: 100 x 2
#   Address                    name                                                                                                      
#   <chr>                      <chr>                                                                                                     
# 1 00 RT 104, Irondequoit     Irondequoit - Wayne County Expressway, Irondequoit Bay Bridge, Bay Bridge                                 
# 2 00 RT 104, Webster         Empire Visionworks                                                                                        
# 3 1000 E HENRIETTA RD, Brig… Brighton, Pioneer Hall, Alexander Hall, Samuel J. Stabins Physical Education Complex, CSEA Unit 7402, M&T…
# 4 1000 RIDGE RD, Webster     No Match                                                                                                  
# 5 1200 BROOKS AV, Rochester  Rochester, Dunkin'                                                                                        
# 6 1200 MARKETPLACE DR, Henr… Jackson Hewitt Tax Service, Walmart Grocery Pickup and Delivery                                           
# 7 1341 WESTFALL RD, Brighton Brighton                                                                                                  
# 8 1425 PORTLAND AV, Rochest… Rochester, Laboratory Service Center - Rochester General Hospital, Imelda C MacDonald, MD, Hyun Jin Yoo, …
# 9 1490 HUDSON AV, Rochester  Rochester, Walmart Supercenter, Jackson Hewitt Tax Service, West Irondequoit                              
#10 1555 LONG POND RD, Greece  Timothy R. McCormick Transitional Care Center at Park Ridge Living Center, Unity Hospital - Emergency Cen…
# … with 90 more rows
库(tidyverse)
测试%>%
分组人(地址)%>%
总结(名称=toString(扁平化(地名)))
#一个tibble:100x2
#地址名
#                                                                                                                              
#Irondequoit Irondequoit-Wayne县高速公路Irondequoit海湾大桥Irondequoit海湾大桥100 RT 104
#2 00 RT 104,韦伯斯特帝国Visionworks
#布莱顿桥亨里埃塔东路1000号,先锋大厅,亚历山大大厅,塞缪尔·J·斯塔宾斯体育中心,CSEA 7402单元,M&T…
#韦伯斯特岭路4号,1000号,没有对手
#5 1200布鲁克斯大道,罗切斯特罗切斯特,邓肯
#6 1200 MARKETPLACE DR,Henr…Jackson Hewitt税务服务,沃尔玛杂货店收货和送货
#布莱顿韦斯特福尔路1341号
#8 1425波特兰大道,罗切斯特…罗切斯特,实验室服务中心-罗切斯特总医院,伊梅尔达C麦克唐纳,马里兰州,玄真尧…
#9 1490哈德逊大道,罗切斯特罗切斯特,沃尔玛超级中心,杰克逊休伊特税务局,西铁德奎特
#希腊长塘路10号1555蒂莫西·R·麦考密克过渡性护理中心联合医院公园岭生活中心急诊中心…
#…还有90行
库(tidyverse)
测试%>%
mutate(place_names=map(place_names,unlist))%>%#更新到字符值列表
unest()%>%#取消对该列的设置
分组依据(地址)%>%#每个地址
总结(name=paste0(地名,collapse=“,”)#组合名称
##A tible:100 x 2
#地址名
#                                                                                                         
#Irondequoit Irondequoit-Wayne县高速公路Irondequoit海湾大桥Irondequoit海湾大桥100 RT 104
#2 00 RT 104,韦伯斯特帝国Visionworks
#3 1000 E HENRIETTA路,布里~布莱顿,先锋大厅,亚历山大大厅,塞缪尔·J·斯塔宾斯体育中心~
#韦伯斯特岭路4号,1000号,没有对手
#5 1200布鲁克斯大道,罗切斯特罗切斯特,邓肯
#6 1200 MARKETPLACE DR,Hen~Jackson Hewitt税务服务,沃尔玛杂货店收货和送货
#布莱顿威斯特福尔路1341号
#8 1425波特兰大道,罗氏~罗彻斯特,实验室服务中心-罗彻斯特总医院,伊梅尔达C麦克唐纳~
#9 1490哈德逊大道,罗切斯特罗切斯特,沃尔玛超级中心,杰克逊休伊特税务局,西铁德奎特
#希腊LONG POND路10号1555 Timothy R.McCormick过渡期护理中心位于Unity Hosp公园岭生活中心~
# # ... 还有90行
这个怎么样

假设data.frame被称为
d

d$pn <- sapply(d$place_names, function(x) paste(x[[1]], collapse = ', '))

d$pn试试这个
test%>%unest()%%>%groupby(Address)%%>%summary(name=paste0(name,collapse=“,”)
)。请注意,这将重新排列您的
地址
列。我认为
unnest()
在这里不起作用。。。我一直收到这样的错误消息:
每列必须是向量列表或数据帧列表
您之前发布的数据集有一个数据帧作为列元素。看起来您现在发布了所需的数据集,并替换了原始数据集……哦,您是对的。谢谢。在新的数据集中,有些列表元素不是data.frame。i、 e.No Match“你想对itI做什么?我发布了完整的数据集@akrun,而不是一个样本数据集。当我运行上述代码时,我在UseMethod(“mutate_”)中收到一条错误消息:没有适用于“mutate_”的方法应用于类的对象”字符“
很抱歉没有在开始时发布完整的数据集@JasonBaik刚刚检查了你的全部数据。一些元素是
“不匹配”
d$pn <- sapply(d$place_names, function(x) paste(x[[1]], collapse = ', '))