我有一个如下所示的CSV文件:
t.trend.dates. sig
2/23/2017 2
2/23/2017 4
2/23/2017 6
2/23/2017 8
2/23/2017 9
2/23/2017 11
2/23/2017 12
2/23/2017 13
2/22/2017 14
2/23/2017 15
2/23/2017 16
2/23/2017 17
2/23/2017 18
2/23/2017 19
2/23/2017 20
2/23/2017 21
2/22/2017 24
我已经使用
将其读入R.TrendIndices <- read.csv("TrendingSignals.csv", header = TRUE, sep=" ")
然后返回
t.trend.dates. X..sig.
1 2017-02-23 ,2
2 2017-02-23 ,4
3 2017-02-23 ,6
4 2017-02-23 ,8
5 2017-02-23 ,9
6 2017-02-23 ,11
7 2017-02-23 ,12
8 2017-02-23 ,13
9 2017-02-22 ,14
10 2017-02-23 ,15
11 2017-02-23 ,16
12 2017-02-23 ,17
13 2017-02-23 ,18
14 2017-02-23 ,19
15 2017-02-23 ,20
16 2017-02-23 ,21
17 2017-02-22 ,24
> str(TrendIndices)
'data.frame': 17 obs. of 2 variables:
$ t.trend.dates.: Factor w/ 2 levels "2017-02-22","2017-02-23": 2 2 2 2 2 2 2 2 1 2 ...
$ X..sig. : Factor w/ 17 levels ",11",",12",",13",..: 10 14 15 16 17 1 2 3 4 5 ...
我已经尝试过两次
write.csv(sig.trend, file="TrendingSignals", row.names = False, stringsAsFactors=FALSE)
TrendIndices <- read.csv("TrendingSignals.csv", header = TRUE, sep=" ", stringsAsFactors=FALSE)
但我一直收到错误&#34; eval中的错误(expr,envir,enclos):object&#39; False&#39;找不到&#34;
非常感谢帮助。
答案 0 :(得分:0)
你可以试试这个:
TrendIndices <- read.table("TrendingSignals.csv", sep = "" , header = TRUE
, stringsAsFactors= FALSE)
给出:
> TrendIndices
t.trend.dates. sig
1 2/23/2017 2
2 2/23/2017 4
3 2/23/2017 6
4 2/23/2017 8
5 2/23/2017 9
6 2/23/2017 11
7 2/23/2017 12
8 2/23/2017 13
9 2/22/2017 14
10 2/23/2017 15
11 2/23/2017 16
12 2/23/2017 17
13 2/23/2017 18
14 2/23/2017 19
15 2/23/2017 20
16 2/23/2017 21
17 2/22/2017 24
> str(TrendIndices)
'data.frame': 17 obs. of 2 variables:
$ t.trend.dates.: chr "2/23/2017" "2/23/2017" "2/23/2017" "2/23/2017" ...
$ sig : int 2 4 6 8 9 11 12 13 14 15 ...