Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading very small numbers in R

Tags:

r

read.table

So I'm trying to generate some plots for my dataset, but I've encountered a certain problem with some values.

Some values are very small: 1.62132528761108e-1916 small to be exact and when it's read on R, it turns into 0.00000000000e+00

I'm reading my data like so:

df <- read.table("path/to/file", header = T, sep = ' ', numerals = "no.loss")

and even with the numerals flag set to no.loss, the number turns to 0.

How can I read the exact number?

like image 830
Pavlos Panteliadis Avatar asked Sep 02 '25 15:09

Pavlos Panteliadis


1 Answers

Standard numeric data type in R (8-byte double precision) does not support such small numbers. The smallest positive number is about 1e-300

.Machine$double.xmin
# [1] 2.225074e-308

Can you convince whatever program generates your input data to save it in, say, logarithms?

like image 98
Andrey Shabalin Avatar answered Sep 05 '25 06:09

Andrey Shabalin