[R] Remove comma (,) in data set

Philippe Glaziou glaziou at pasteur-kh.org
Wed Oct 1 03:16:41 CEST 2003


Muhammad Subianto <subianto at cs.uu.nl> 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




More information about the R-help mailing list