I have noticed an issue with the rounding in spread()
(and I assume gather()
). I have re-created the issue with some dummy data (below). What happens, is that when using spread()
with doubles of more than 4 decimal places, the output of the spread has only 3 decimal places.
If anyone can shed some light on this that would be very helpful since I need to retain the 4 decimal place accuracy.
# Loading packages
library(tidyverse)
# Creating a dummy data set.
dummy_data <- tibble(
day_of_week = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday"),
person = c("Jack", "Bob", "Bob", "Simon", "Simon"),
value = c(0.2346, 0.7635, 0.7253, 0.7356, 0.1693)
)
# Spreading the data.
spread_data = dummy_data %>%
spread(person, value)