使用 read.csv() 时的特殊分隔符
Special delimiter when use read.csv()
我有很多使用“|”的 .csv 文件作为分隔符:
1492624841097281|"19026960706021"|"3112642370"|"50000"|"0"|"VND"|""|""|"50000
我试着像下面这样阅读它们
read.csv("a.csv",head=T, sep="|")
和
read.csv("a.csv",head=T, sep="\|")
我希望列会分开,但它不起作用。请帮我!非常感谢。
在read.csv("a.csv",head=T, sep="|")
中添加quote=""
read.csv("a.csv",head=F, sep="|",quote="") # if the line is meant to be values
V1 V2 V3 V4 V5 V6 V7 V8 V9
1 "1492624841097281 ""19026960706021"" ""3112642370"" ""50000"" ""0"" ""VND"" """" """" ""50000"
read.csv("a.csv",head=T, sep="|",quote="") # if the line is meant to be the title
[1] X.1492624841097281 X..19026960706021.. X..3112642370.. X..50000.. X..0..
[6] X..VND.. X.... X.....1 X..50000.
<0 rows> (or 0-length row.names)
我有很多使用“|”的 .csv 文件作为分隔符:
1492624841097281|"19026960706021"|"3112642370"|"50000"|"0"|"VND"|""|""|"50000
我试着像下面这样阅读它们
read.csv("a.csv",head=T, sep="|")
和
read.csv("a.csv",head=T, sep="\|")
我希望列会分开,但它不起作用。请帮我!非常感谢。
在read.csv("a.csv",head=T, sep="|")
中添加quote=""
read.csv("a.csv",head=F, sep="|",quote="") # if the line is meant to be values
V1 V2 V3 V4 V5 V6 V7 V8 V9
1 "1492624841097281 ""19026960706021"" ""3112642370"" ""50000"" ""0"" ""VND"" """" """" ""50000"
read.csv("a.csv",head=T, sep="|",quote="") # if the line is meant to be the title
[1] X.1492624841097281 X..19026960706021.. X..3112642370.. X..50000.. X..0..
[6] X..VND.. X.... X.....1 X..50000.
<0 rows> (or 0-length row.names)