“字符也在我的行中分隔英寸,但这会扰乱CSV文件的读取,如何解决?[关闭]

The " character also delimits inches in my rows but this messes up the reading of the CSV file, how to fix? [closed]

提问人:Martijn 提问时间:11/13/2023 最后编辑:Martijn 更新时间:11/17/2023 访问量:21

问:


编辑问题以包括所需的行为、特定问题或错误以及重现问题所需的最短代码。这将帮助其他人回答这个问题。

8天前关闭。

我已通过CSV文件将数据从ERP导出到R。这些行包含不同的产品,某些产品包含 “ 作为英寸的标记。这会扰乱 csv 的读取,并将大量变量替换或放置到一列中。我应该手动编辑所有变量名称,还是有更好的解决方案。

我尝试将引号设置为空白并使用其他读取选项,例如 .table 和 .delim。

structure(list(Consumenten.Adviesprijs = c(119.95, 79.95, 79.95, 
79.95, 79.95, 79.95, 109.95, 109.95, 109.95, 54.95, 39.9, 375, 
375, 389, 389, 389, 179, 179, 179, 179, 199), Locatie.III = c(NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA), Barcode.doos = c(NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), Barcode.binnendoos = c(NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA), Locatie.I = c("DE012", "", "", "", "", "", "", 
"", "", "", "DE012", "ZF011", "ZF011", "ZF011", "ZF011", "ZF011", 
"", "", "", "", ""), Locatie.II = c(NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), Zoektermen = c(NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA), Leverancier = c("Kwadie", "Kwadie", "Kwadie", 
"Kwadie", "Kwadie", "Kwadie", "Kwadie", "Kwadie", "Kwadie", "Kwadie", 
"Kwadie", "", "", "", "", "", "fillername", "fillername", "fillername", "fillername", 
"fillername"), Verpakkingseenheid = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, NA, NA, NA, NA, NA, 1L, 1L, 1L, 1L, 1L), Artikelnummer.leverancier = c("91658000151", 
"3003-0004", "3003-0004", "3003-0004", "3003-0004", "3003-0004", 
"9165800011", "9165800011", "9165800011", "AC200211", "9165800013", 
"", "", "", "", "", "AF127001", "AF127001", "AF127002", "AF127002", 
"AF167002"), RBS = c("True", "True", "True", "True", "True", 
"True", "True", "True", "True", "True", "True", "False", "False", 
"False", "True", "True", "True", "True", "True", "True", "True"
), Afbeelding = c("True", "True", "True", "True", "True", "True", 
"True", "True", "True", "True", "True", "False", "False", "False", 
"False", "False", "True", "True", "True", "True", "True"), Nieuw = c("False", 
"False", "False", "False", "False", "False", "False", "False", 
"False", "False", "False", "False", "False", "False", "False", 
"False", "False", "False", "False", "False", "False"), Opruiming = c("False", 
"False", "False", "False", "False", "False", "False", "False", 
"False", "False", "False", "False", "False", "False", "False", 
"False", "False", "False", "False", "False", "False"), Datum.voorraad.controle = c("10-11-2021", 
"19-9-2023", "19-9-2023", "19-9-2023", "19-9-2023", "19-9-2023", 
"3-2-2023", "3-2-2023", "3-2-2023", "3-2-2023", "10-11-2021", 
"3-1-2023", "3-1-2023", "10-1-2023", "3-1-2023", "3-1-2023", 
"10-1-2023", "10-1-2023", "10-1-2023", "10-1-2023", "10-1-2023"
), Barcode = c(4013674106783, 4013674187744, 4013674187744, 4013674187744, 
4013674187744, 4013674187744, 4013674128716, 4013674128716, 4013674128716, 
NA, 4013674009749, 11124020, 11124020, NA, NA, NA, 8715291087259, 
8715291087259, 8715291087266, 8715291087266, 8715291087303), 
    DST.sub = c("R", "R", "R", "R", "R", "R", "R", "R", "R", 
    "R", "R", "D", "D", "A", "A", "A", "C", "C", "C", "C", "C"
    ), DST.subsub = c(10L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 
    10L, 10L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), Merk = c("Ansmann", 
    "Ansmann", "Ansmann", "Ansmann", "Ansmann", "Ansmann", "Ansmann", 
    "Ansmann", "Ansmann", "Ansmann", "Ansmann", "fillername", "fillername", 
    "fillername", "fillername", "fillername", "fillername", "fillername", "fillername", "fillername", "fillername"
    ), Model = c("", "", "", "", "", "", "", "", "", "", "", 
    "meisjes", "meisjes", "dames", "dames", "dames", "jongens", 
    "jongens", "jongens", "jongens", "jongens"), Kleur = c("", 
    "", "", "", "", "", "", "", "", "", "", "violet", "violet", 
    "babyblauw", "violet", "violet", "zwart/geel", "zwart/geel", 
    "blauw/lime", "blauw/lime", "blauw/lime"), Maat = c("", "", 
    "", "", "", "", "", "", "", "", "", "24\",1,1,11124020,2.00,13-11-2022,13-11-2023,375.00,\",\",\",ZF011,\",\",\",\",\",False,False,False,False,3-1-2023,11124020,D,0,fillername,meisjes,violet,24", 
    "24\",1,1,11124020,2.00,13-11-2022,13-11-2023,375.00,\",\",\",ZF011,\",\",\",\",\",False,False,False,False,3-1-2023,11124020,D,0,fillername,meisjes,violet,24", 
    "26\",1,1,11126010,0.00,13-11-2022,13-11-2023,389.00,\",\",\",ZF011,\",\",\",\",\",False,False,False,False,10-1-2023,\",A,0,fillername,dames,babyblauw,26", 
    "26\",1,1,11126020,2.00,13-11-2022,13-11-2023,389.00,\",\",\",ZF011,\",\",\",\",\",True,False,False,False,3-1-2023,\",A,0,fillername,dames,violet,26", 
    "26\",1,1,11126020,2.00,13-11-2022,13-11-2023,389.00,\",\",\",ZF011,\",\",\",\",\",True,False,False,False,3-1-2023,\",A,0,fillername,dames,violet,26", 
    "12''", "12''", "12''", "12''", "16''"), minimale.bestelhoeveelheid = c(1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L), DST.main = c(2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
    ), Artikelcode = c("10000151", "10000165", "10000165", "10000165", 
    "10000165", "10000165", "10800011", "10800011", "10800011", 
    "10800012", "10800013", "12-10-2023", "31-10-2023", "12-10-2023", 
    "12-10-2023", "31-10-2023", "12127001", "12127001", "12127002", 
    "12127002", "12167002"), ArtikelBeginStand = c("3.00", "0.00", 
    "0.00", "0.00", "0.00", "0.00", "1.00", "1.00", "1.00", "0.00", 
    "1.00", "Factuur  20233294", "Voorraadverschil (afname)  ", 
    "Factuur  20233295", "Factuur  20233296", "Voorraadverschil (afname)  ", 
    "0.00", "0.00", "0.00", "0.00", "0.00"), BegindatumPeriode = c("13-11-2022", 
    "13-11-2022", "13-11-2022", "13-11-2022", "13-11-2022", "13-11-2022", 
    "13-11-2022", "13-11-2022", "13-11-2022", "13-11-2022", "13-11-2022", 
    "310, fillername", "", "310, fillername", 
    "310, fillername", "", "13-11-2022", 
    "13-11-2022", "13-11-2022", "13-11-2022", "13-11-2022"), 
    EinddatumPeriode = c("13-11-2023", "13-11-2023", "13-11-2023", 
    "13-11-2023", "13-11-2023", "13-11-2023", "13-11-2023", "13-11-2023", 
    "13-11-2023", "13-11-2023", "13-11-2023", "1.00", "-3.00", 
    "1.00", "1.00", "-3.00", "13-11-2023", "13-11-2023", "13-11-2023", 
    "13-11-2023", "13-11-2023"), Datum = c("10-2-2023", "19-9-2023", 
    "19-9-2023", "22-9-2023", "3-10-2023", "6-10-2023", "3-2-2023", 
    "25-8-2023", "25-8-2023", "3-2-2023", "24-7-2023", "", "", 
    "", "", "", "19-10-2023", "20-10-2023", "19-10-2023", "20-10-2023", 
    "19-10-2023"), MutatieRedenOmschrijving = c("Factuur  20230434", 
    "Ontvangst  ", "Factuur  20233046", "Pakbon  20236206", "Factuur  20233248", 
    "Ontvangst  ", "Factuur  20230358", "Ontvangst  ", "Factuur  20232676", 
    "Ontvangst  ", "Factuur  20232314", "", "", "", "", "", "Factuur  20233438", 
    "Ontvangst  ", "Factuur  20233438", "Ontvangst  ", "Factuur  20233438"
    ), Aantal = c(-1, 
    2, -1, -1, -1, 1, -1, 1, -1, 1, -1, NA, NA, NA, NA, NA, -1, 
    1, -1, 1, -1)), class = "data.frame", row.names = c(NA, -21L
))

从第 12 行到第 16 行,数据读取被“标记”阻挡。quote = “” 不起作用

r csv

评论


答: 暂无答案