My application is reading the xls
and xlsx
files using the read_excel
function of the readxl
package.
The sequence and the exact number of columns are not known earlier while reading the xls
or xlsx
file. There are 15 predefined columns out of which 10 columns are mandatory and remaining 5 columns are optional. So the file will always have minimum 10 columns and at maximum 15 columns.
I need to specify the the col-types
to the mandatory 10 columns. The only way I can think of is using the column names to specify the col_types
as I know for fact that the file has all 10 columns which are mandatory but they are in the random sequence.
I tried looking out for the way of doing so but failed to do so.
Can anyone help me find a way to assign the col_types by column names?