Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop read.table from rounding numbers with different degrees of precision in R? [duplicate]

I am trying to import a text file containing latitudes and longitudes into R, which all have different degrees of precision (i.e. points after the decimal). When I try to use read.table, the data imports but cuts off at 5 decimal places. Is there a way around this? I have not found anything in the documentation that worked.

An example of data from the text file:

35.326354762000001 91.761496755
35.512443542 92.356571172
35.319078183999999 92.233513991
35.315654623 91.912230315
35.293864976999998 92.442997238
35.435569418 92.231860894

Thanks.

like image 254
user41569 Avatar asked Oct 16 '25 04:10

user41569


1 Answers

read.table doesn't round (unless you provide more than ~16 digits behind the comma), but indeed the precision to which the answer is printed may be controlled with options(digits=[n])


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!