I’m importing some messy data from a range of Excel Binary Workbooks (.xlsb) using readxlsb and cell_limits(), from cellranger. I'm struggling to get enough (all) decimal places.
This can be illustrated with the dataset that is supplied with the readxlsb package. In the example data, TestBook.xlsb, in sheet Sheet3.1.1, cell E5. This cell contains e^1, with a range of underlying decimal places (2,71828182845905), but is only imported with six decimal places (2.718282).
In my real life data I have text in a lot of the top lines, which convert the data to charters, like column.4 below, where E5 resides, and raw data with ~16 decimal places. Is there a way I can tweak the code (below) to get all the decimal places without loosing cellranger::cell_limits()?
# install.packages(c("readxlsb", "tidyverse"), dependencies = TRUE)
library(readxlsb); library(tidyverse)
as_tibble(
read_xlsb(path = system.file("extdata", "TestBook.xlsb", package = "readxlsb"),
sheet = "Sheet3.1.1",range = cellranger::cell_limits())
)
# A tibble: 5 x 7
Some column.2 column.3 column.4 column.5 column.6 column.7
<date> <chr> <chr> <chr> <chr> <chr> <dbl>
1 NA "data" "" "2.718282" "" "" 3.14
2 NA "" "in" "" "" "" NA
3 2021-05-21 "" "" "a" "" "" NA
4 NA "" "" "" "third" "" 43972
5 NA "" "" "" "" "sheet" NA