没有逗号的日期列表

时间:2015-09-08 14:35:56

标签: r list date

我有这个txt文件

"","x"
"1","2005-01-31"
"2","2005-03-31"
"3","2005-03-31"
"4","2005-05-31"
"5","2005-05-31"
"6","2005-07-31"
"7","2005-07-31"
"8","2005-08-31"
"9","2005-10-31"
"10","2005-10-31"

每月日期列表。如何获得相同的列表,但没有逗号,如下所示:

"x"
"1" "2005-01-31"
"2" "2005-02-28"
"3" "2005-03-31"
"4" "2005-04-29"
"5" "2005-05-31"
"6" "2005-06-30"
"7" "2005-07-29"
"8" "2005-08-31"
"9" "2005-09-30"
"10" "2005-10-31"

谢谢!

1 个答案:

答案 0 :(得分:0)

您只需在加载文件时指定分隔符

read.csv(file, header = TRUE, **sep = ","**)