This is the my code. I have an xlsx file with multiple worksheets and I am trying to load the first worksheet.
I used the RStudio Excel IDE to load the worksheet
Which generated the below code but it considered all the attributes as character but it should have identified the first and the fourth as numeric so I had changed it manually before importing.
> PharmacyMaster <- read_excel("~/Desktop/R/ABDataSet(WithDataSetMaster).xlsx",
+ sheet = "PHRMCY MASTER", col_types = c("numeric",
+ "text", "text", "numeric"))
The dataset got imported but I received 50 warnings, which I am not sure what are they referring to.
There were 50 or more warnings (use warnings() to see the first 50)
> View(PharmacyMaster)
> warnings()
Warning messages:
1: In read_fun(path = path, sheet = sheet, limits = limits, ... :
Coercing text to numeric in A2 / R2C1: '1017330163607345979'
2: In read_fun(path = path, sheet = sheet, limits = limits, ... :
Coercing text to numeric in D2 / R2C4: '070'
3: In read_fun(path = path, sheet = sheet, limits = limits, ... :
Coercing text to numeric in A3 / R3C1: '1041420479647471411'
4: In read_fun(path = path, sheet = sheet, limits = limits, ... :
Coercing text to numeric in D3 / R3C4: '071'
5: In read_fun(path = path, sheet = sheet, limits = limits, ... :
Coercing text to numeric in A4 / R4C1: '1048827871928328746'
I have checked the structure of my loaded dataset,
> str(PharmacyMaster)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 1097 obs. of 4 variables:
$ PHRMCY_NBR: num 1.02e+18 1.04e+18 1.05e+18 1.06e+18 1.06e+18 ...
$ PHRMCY_NAM: chr "GNP PHARMACY #1" "GNP PHARMACY #2" "GNP PHARMACY #3" "GNP PHARMACY #4" ...
$ ST_CD : chr "NJ" "NJ" "MA" "NJ" ...
$ ZIP_3_CD : num 70 71 21 70 100 11 70 193 75 70 ...
I have two questions, 1. Why couldn't readxl identify the numeric columns and load as numeric, which you can see from the IDE screenshot I had changed it manually. (Can find snapshot of the dataset below) 2. What do the warnings mean?
P.S. There are no quoted values or empty values in the numeric column of the dataset, I have checked manually all 1097 rows for that.