Hi R users:

I tried the following coding:
COMPdata <- read.csv("D:/........./Book1.csv", header=TRUE, sep=",")
INDEX <- COMPdata[, 1]
1M <- COMPdata[, 2]
2M <- COMPdata[, 3]

The partial list of original data Book1.csv is listed below:
INDEX 1M 2M 3M 4M 
1  0.0001026472  0.0001026472  0.0001427507  0.0001026147  
2  0.0001026109  0.0001026109  0.0001453323  0.0001029040  
3  0.0001169544  0.0001169544  0.0001326488  0.0001070135  
4  0.0001159930  0.0001159930  0.0001362505  0.0001048737  
5  0.0001212301  0.0001212301  0.0001320264  0.0001139550  
6  0.0001211852  0.0001211852  0.0001247280  0.0001137742  

The dataset read-in looks fine:
> head(COMPdata)
  INDEX          X1M          X2M          X3M          X4M
1     1 0.0001026472 0.0001026472 0.0001427507 0.0001026147
2     2 0.0001026109 0.0001026109 0.0001453323 0.0001029040
3     3 0.0001169544 0.0001169544 0.0001326488 0.0001070135
4     4 0.0001159930 0.0001159930 0.0001362505 0.0001048737
5     5 0.0001212301 0.0001212301 0.0001320264 0.0001139550
6     6 0.0001211852 0.0001211852 0.0001247280 0.0001137742

Nothing wrong with the first column:
> INDEX <- COMPdata[, 1]

However, it gives me the error message below
> 1M <- COMPdata[, 2]
Error: Unexpected symbol in "1M"

So do the other variables 2M, 3M, and 4M.


Could some people share advice to solve this problem?

Thanks for your kind attention.

Weihan

	[[alternative HTML version deleted]]

