Re: [R] read.table() and scientific notation

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue 10 Oct 2006 - 10:52:59 GMT

Your example does not exhibit that behavior when I try it (below). Can you provide a reproducible example following the style shown here:

> Lines <- "a 1 2e-4

+ b 2 3e-8"
>
> DF <- read.table(textConnection(Lines))
> str(DF)
'data.frame': 2 obs. of 3 variables:

 $ V1: Factor w/ 2 levels "a","b": 1 2
 $ V2: int  1 2
 $ V3: num  2e-04 3e-08

> R.version.string # Windows XP
[1] "R version 2.4.0 (2006-10-03)"

On 10/10/06, January Weiner <january@uni-muenster.de> wrote:
> Dear all,
>
> I am having troubles importing values written as scientific notation
> using read.table(). I'm sure this is a frequent problem, as many
> people in my lab have this problem as well, so I'm sure that I just
> have troubles googling for the right solution.
>
> The problem is, that, given a file like that:
>
> a 1 2e-4
> b 2 3e-8
> ...
>
> the third column gets imported as a factor, or a string if I set the
> as.is parameter of read.table to TRUE for this column. However, I just
> want a simple numeric vector :-) I'm sure there is a simple trick for
> this. If you can point me to the right function, or manual, I think I
> should be able to find out the details myself.
>
> Thanks in advance,
> January
>
> --
> ------------ January Weiner 3 ---------------------+---------------
> Division of Bioinformatics, University of Muenster | Schloßplatz 4
> (+49)(251)8321634 | D48149 Münster
> http://www.uni-muenster.de/Biologie.Botanik/ebb/ | Germany
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>



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 and provide commented, minimal, self-contained, reproducible code. Received on Tue Oct 10 21:09:25 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 10 Oct 2006 - 11:30:12 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.