[R] Remove comma (,) in data set

2003-09-30 Thread Muhammad Subianto
Dear R-helper,
I am new learning R. Now, I have a data set like:
24,2,3,3,1,1,2,3,0,1
45,1,3,10,1,1,3,4,0,1
43,2,3,7,1,1,3,4,0,1
42,3,2,9,1,1,3,3,0,1
36,3,3,8,1,1,3,2,0,1
19,4,4,0,1,1,3,3,0,1
38,2,3,6,1,1,3,2,0,1
21,3,3,1,1,0,3,2,0,1
27,2,3,3,1,1,3,4,0,1
45,1,1,8,1,1,2,2,1,1
... with 3730 rows
I want to remove comma (,) in data set. The result like:

24 2 3  3 1 1 2 3 0 1
45 1 3 10 1 1 3 4 0 1
43 2 3  7 1 1 3 4 0 1
42 3 2  9 1 1 3 3 0 1
36 3 3  8 1 1 3 2 0 1
19 4 4  0 1 1 3 3 0 1
38 2 3  6 1 1 3 2 0 1
21 3 3  1 1 0 3 2 0 1
27 2 3  3 1 1 3 4 0 1
45 1 1  8 1 1 2 2 1 1
...
How can I do it. Thanks you for your help.

Best regards,

Muhammad Subianto

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Remove comma (,) in data set

2003-09-30 Thread Duncan Murdoch
On Tue, 30 Sep 2003 18:51:52 +0200, Muhammad Subianto
[EMAIL PROTECTED] wrote :

Dear R-helper,
I am new learning R. Now, I have a data set like:

24,2,3,3,1,1,2,3,0,1
45,1,3,10,1,1,3,4,0,1
... with 3730 rows

I want to remove comma (,) in data set. The result like:

24 2 3  3 1 1 2 3 0 1
45 1 3 10 1 1 3 4 0 1
...
How can I do it. Thanks you for your help.

I assume you're talking about reading a file with commas, and writing
one without.

Use one of the read functions (e.g. read.csv, read.table, or scan)
which can deal with the commas on input.  Then write using write.table
with the default separator, a space.

You'll likely want non-default choices for the row.names and col.names
parameters.

Duncan Murdoch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Remove comma (,) in data set

2003-09-30 Thread Philippe Glaziou
Muhammad Subianto [EMAIL PROTECTED] wrote:
 I am new learning R. Now, I have a data set like:
 
 24,2,3,3,1,1,2,3,0,1
 45,1,3,10,1,1,3,4,0,1
 ... with 3730 rows
 
 I want to remove comma (,) in data set. The result like:
 
 24 2 3  3 1 1 2 3 0 1
 45 1 3 10 1 1 3 4 0 1
 ...
 
 How can I do it. Thanks you for your help.


Assuming your dataset is stored in a flat ascii file, you need
not use R for this trivial translation of the character , into
a space  . From your shell (i.e., if standard shell tools are
available on your machine), type the following:

cat file1 | tr ,file2

-- 
Philippe Glaziou
Institut Pasteur du Cambodge

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help