Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why the data are different using vroom_write and vroom #531

Closed
ZTZK opened this issue Mar 21, 2024 · 1 comment
Closed

Why the data are different using vroom_write and vroom #531

ZTZK opened this issue Mar 21, 2024 · 1 comment

Comments

@ZTZK
Copy link

ZTZK commented Mar 21, 2024

Hi,
Thanks for creating this package. It's awesome.
I encountered a problem with the vroom_write. Below is the code.

number=0.8914392590522770554173
data1=tibble::tibble(c1=number)
vroom::vroom_write(data1,"testnumber.csv")
data2=vroom::vroom("testnumber.csv",delim = ",")
data1$c1[1]==data2$c1[1]

The result shows that two numbers are different. I wonder why this happens.
image

@jennybc
Copy link
Member

jennybc commented Mar 21, 2024

This is a matter of floating point numbers and is not specific to vroom (or R, even). But here's the most relevant R FAQ that explains this:

https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f-1

@jennybc jennybc closed this as completed Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants