Add integer to a float and get the output as float in r

650 views Asked by At
x <- 1626307200

y = 0.034

x+y

I want to add these two numbers in r and save it as a float (1626307200.034). Both numbers are in numeric format. Tried several ways but didn't work

1

There are 1 answers

0
Russ Conte On BEST ANSWER

There is a command to allow R to display more digits:

options(digits = 15)
x <- 1626307200
y <- 0.034

z = x + y
z # 1626307200.034