Hi every one,
I have a text file like this:
1    4   4    1    6    23
1   4    2    2    3    28
1    4    5    1    2    24
1    2    3    1    1    24
1   2    3    1    2     40
1   2   3    1    4      22

I want to separate columns by comma, like this:
1,4,4,1,6,23
1,4,2,2,3,28
1,4,5,1,2,24
1,2,3,1,1,24
1,2,3,1,2,40
1,2,3,1,4,22  

I used this code:
mydata=read.table("data.txt",sep=",")
but I see this output:
1\t4\t4\t1\t6\t231\t4\t2\t2\t3\t28
...  
please correct my code
Thanks in advance
Elham

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to