Re: [R] how to ignore or omit somethings while reading the data table

From: Kishor Tappita <kishor.tappita_at_gmail.com>
Date: Wed, 2 Jan 2008 19:35:30 +0530

Hi,

I have a tempoary fix but I think there can be a better way (R way) to solve this.

If you have a unix account you can do it this way.

$ vi filename

For command prompt press Esc

: s/\$//g

Otherwise you can replace $ sign with a peculiar number say '9999'

:s/\$/9999/g

This substitutes $ signs with 9999 at all places and after u load the data you can replace 9999
with $ sign using regular expressions in R. There is some risk and you have to be careful to chose
the peculiar number.

I am not familiar with regular expressions in R either you or someone in the list can help.

Regards,
Kishor

On Jan 2, 2008 7:05 PM, mrafi <confessin_at_gmail.com> wrote:

>
> yeah...i'd have done that but it is a 20 mb csv file...and then there are
> other columns of data also..which could be distorted by this...
>
> r_a_mueller wrote:
> >
> > Am Mittwoch, 2. Januar 2008 14:14 schrieb mrafi:
> >> hello respected ppl...
> >> am a engg. student...i was trying to use R in statistical calculations
> >> now the problem is..i imported a huge tsv file onto R...it has a column
> > csv?
> >> which gives cost...and it has "$" with each numerical value in this
> >> column...it is something like this..$.05,$.1,$.075...and so on..
> >> R is reading it as "character vector"...
> >> i tried using all the arguments but could only change it to a "factor"
> >> i want to read it as numericals...and perform further operations..
> >> i know it is a stupid problem but can any1 help me get outta this...
> >> thank you all...!!!
> > I'd like to have it simple... open your csv-file in a text editor, with
> > "find/replace" replace your "$" by ""
> >
> > --
> > Richard Müller - Am Spring 9 - D-58802 Balve-Eisborn
> > www.oeko-sorpe.de
> >
> > ______________________________________________
> > R-help_at_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<http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/how-to-ignore-or-omit-somethings-while-reading-the-data-table-tp14578131p14578428.html
> Sent from the R help mailing list archive at Nabble.com<http://nabble.com/>
> .
>
> ______________________________________________
> R-help_at_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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]



R-help_at_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. Received on Wed 02 Jan 2008 - 14:08:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jan 2008 - 14:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive