I am reading an excel sheet into R using the readxl::read_excel
function. While largely this has been a successful have been noticing an issue with certain columns.
Uploaded a demo file in the File dropper link
When the file is read into R using the code
df_excel <- readxl::read_excel(here::here("demo.xlsx"), sheet = 1) %>% janitor::clean_names()
certain values are read as long floating numbers. For example, in the below output 1.1000000000000001
has to be just 1.1.
attempts
- Tried copying the excel column into notepad and repasting into excel.
- Copy the column and paste as text
- reading columns a text while using the
read_excel
function - if I save the excel file into csv the file reads as expected into R. However, other columns ( not provided in the demo) have certain special characters like
Oranges are >= Apple
which csv converts toOranges are ? Apple
. >= is converted to≥
Is there a way I can read the columns properly in excel itself ? Or open the excel sheet to fix them all across columns manually Or any solution with csv to avoid the converting of the special characters to ?
# A tibble: 32 x 2
numbers_1 numbers_2
<chr> <chr>
1 1 1
2 1.1000000000000001 1.1000000000000001
3 1.1000000000000001 1.1000000000000001
4 1.1000000000000001 1.1000000000000001
5 1.1000000000000001 1.1000000000000001
6 1.1000000000000001 1.1000000000000001
7 1.1000000000000001 1.1000000000000001
8 3.2.100 3.2.100
9 3.2.100 3.2.100
10 3.2.100 3.2.100
# ... with 22 more rows