I have a problem for reading a data from excel (.csv) to R, because the
numeric variables ( float) are separeted by comma (,) and not by point (.).
And all the variables are separated by comma (,). The string variables are
between (""). So importing to R the numeric variable (float) are reading as
integer, and not with decimal part.

Is there a way to solve this problem?

The data set is like this:

**CODE,"A1","A2","A3","A4","A5","A6","A7","A8","A9","A10","A11","A12","NOTE1","A13","A14","A15","NOTE2","A16","A17","A18","A19","A20","A21","NOTE3","A22","A23","A24","A25","A26","A27","A28","NOTE4","CONCLUSION"
**
991,"1","14","17","TM

**LUNG","19","CARCINOMA","17",,,"14","14","14",15,57,"2","17","17",17,"3","8","14","14","14","17",13,4,"4","14","17","14","14","14","17",15,15,24
**
**992,"1","17","17","BPCO","17","TM
**

**LUNG","17",,,"17","17","17",17,"2","17","17",17,"3","17","17","17","17","17",17,"4","17","17","17","14","17","17",16,5,16,88
**
993,"1","17","17","TM

**LUNG","17","BPCO","17",,,"17","17","17",17,"2","17","17",17,"3","14","17","17","17","17",16,4,"4","17","17","17","17","14","17",16,5,16,73
**
994,"1","14","14","NN","17","NN","17","NN","17","14","17","17",15,88,"2","14","14",14,"3","14","17","14","17","14",15,2,"4","14","8","17","14","14","14",13,5,14,64

I use this command in R: read.csv(file="prova.csv" , header=TRUE , sep=","
, dec="," , fill=TRUE).

But for example in the first record with code 991: the last part is
recorded in three integer variable 15 - 15 - 24 and not in two float
variable as 15 - 15.24

In the second record with code 992: the last part is recorded in four
integer variable 16 - 5 - 16 - 88 and not in two float variable as 16.5 - 16.88
In the third record with code 993: the middle part is recorded in two
integer variable 16 - 4 and not in one float variable as 16.4. And the last
part is recorded in four integer variable 16 - 5 - 16 - 73 and not in two
float variable as 16.5 - 16.73

And so on.

I there a solution?

Thanks.

Silvia

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!

http://www.R-project.org/posting-guide.html
Received on Mon Apr 11 20:43:49 2005