[R] how to scientific notation numbers

Gabor Grothendieck ggrothendieck at gmail.com
Sat Mar 22 04:03:29 CET 2008


I can't reproduce that on my system.  When I try it it works.  (In
reality you would replace textConnection(Lines) with the name
of your file.)

> Lines <- "
+  6.5500000000000000e+004  2.8235000000000001e+000  3.2000000000000000e+001
+ 1.1580000000000000e+003  2.4400000000000000e+002  5.9800000000000000e+002
+ 2.2700000000000000e+002  3.9030000000000001e+001 -1.2137000000000000e+002"
> read.table(textConnection(Lines))
     V1       V2      V3
1 65500   2.8235   32.00
2  1158 244.0000  598.00
3   227  39.0300 -121.37

> R.version.string # Vista
[1] "R version 2.6.2 alpha (2008-01-26 r44181)"


On Fri, Mar 21, 2008 at 10:53 PM, HelponR <suncertain at gmail.com> wrote:
> Hi, Sorry I have to bother you a question.
>
> I have a file with each line like this:
>
>  6.5500000000000000e+004  2.8235000000000001e+000  3.2000000000000000e+001
> 1.1580000000000000e+003  2.4400000000000000e+002  5.9800000000000000e+002
> 2.2700000000000000e+002  3.9030000000000001e+001 -1.2137000000000000e+002
>
>
> However, I use read.table, it cannot read it correctly. It read in 18
> variables instead of 9.
>
> I am so frustrated. I tried to search the archive. Seems nobody else has
> this problem.
>
> Thank you!
>
> U
>
>        [[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.
>



More information about the R-help mailing list