Re: [R] how to specify modes of certain fields in read.table

From: jim holtman <jholtman_at_gmail.com>
Date: Tue, 12 Feb 2008 17:47:13 -0500

It is just printing them out with that significance; the numbers are stored with about 15 digits. If you want more, use 'options':

> x <- scan(textConnection("641673.78807

+
+ 3607080.78438
+
+ 641436.56207
+
+ 3607108.30543
+
+ 641165.28042
+
+ 3607136.82957
+
+ 640879.58373
+
+ 3607116.20568
+
+ "), what=0)

Read 8 items
> x

[1] 641673.8 3607080.8 641436.6 3607108.3 641165.3 3607136.8 640879.6 3607116.2
> options(digits=20)
> x

[1] 641673.78807 3607080.78438 641436.56207 3607108.30543 641165.28042 3607136.82957 640879.58373
[8] 3607116.20568
>

On Feb 12, 2008 5:40 PM, Weidong Gu <wgu_at_uab.edu> wrote:

> I have a data file with 50 columns. Among them, there are two
> coordinates, X and Y
>
> X
>
> Y
>
> 641673.78807
>
> 3607080.78438
>
> 641436.56207
>
> 3607108.30543
>
> 641165.28042
>
> 3607136.82957
>
> 640879.58373
>
> 3607116.20568
>
>
>
> When I use read.table, it rounds X and Y to the maximal 8 decimal number
> as.
>
>
>
> 641673.8 3607081
>
> 641436.6 3607108
>
> 641165.3 3607137
>
> 640879.6 3607116
>
> 640683.5 3607105
>
>
>
> My question is how to specify these two columns in read.table. Maybe
> colClasses helps but I have 50 columns...
>
>
>
> Thanks
>
>
>
> Weidong Gu,
>
> Department of Medicine
> University of Alabama, Birmingham
> 1900 University Blvd., Birmingham, Alabama 35294
> Email: wgu_at_uab.edu
> PH: (205)-975-9053
>
>
>
>
> [[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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[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 Tue 12 Feb 2008 - 22:56:44 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 Tue 12 Feb 2008 - 23:30:13 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