How to make read_excel stops messaging when using col_names = FALSE?

I'm using read_excel but as a internal function in my package, and I need to extract some specific rows from a excel document. Problem is that when using the package interactively I get:

New names:                                                                      
* `` -> `..1`

For the purpose of my package this is confusing. I know I can suppress the output message using suppressMessages(), but I imagine there should be a non verbose option on read_excel (my guess is something about .name_repair).

Is the structure of the excel document constant? Or at least reliable?

If so you can set the colnames argument of the read_excel() function to a known vector.

It should make the message go away.

Yes, this works. I don't know if it this is a better workaround than using supressMessages(). I'm still surprised that it doesn't have an option to keep it quiet.

You can always sink the output to /dev/null...

readxl::read_excel() is in this matter consistent with readr::read_csv(), so I don't expect it to be a coincidence.

You can use a custom value in .name_repair argument to deactivate or customise the name repairing.

You can add any function you want, or use minimal for just existence checking.
This could suppress the message you see.

read_excel(..., .name_repair = "minimal")

All the name repairing mechanism are in tibble where you can find some documentation.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.