I have a problem with detection of the column types when importing data into R using the read_excel
function of readxl
package.
There are lot's of Q&As that are similar to my issue like this or this.
However I am still struggling.
Assume, I have an .xls
file with just a one column INN
that contains digits only; however, it needs to be imported as character type (as the data could start with 0, and the 0 is very important).
Here is the code I used:
data = read_excel('data.xls', col_types = c('text'))
When I import the data, it looks like this:
INN
1 2123123
As a result INN
detected as character however in some rows where INN
starts with 0, the 0 is dropped which is unacceptable.
I want the output to look like this:
INN
1 02123123
Any ideas how I could overcome my issue?