mdlincoln / clipr

R functions for reading and writing from the system clipboard
http://matthewlincoln.net/clipr/
151 stars 24 forks source link

Default `col.names` FALSE when content is matrix #35

Closed NikNakk closed 5 years ago

NikNakk commented 6 years ago

Is there any reason that col.names defaults to FALSE when writing a matrix to the clipboard? There's an explicit check for this in clipr:::table_str:

    if (is.matrix(content)) 
        .dots$col.names <- ifelse(is.null(.dots$col.names), FALSE, 
            .dots$col.names)

I had been working around this by coercing to a data.frame first, though I see I can now just pass col.names = TRUE to clipr::write_clip.

It's presumably too late to change the default, since it may break people's existing code, but it would useful if the default could be set using an option, particularly since this is almost always something that will be used interactively.

mdlincoln commented 6 years ago

Thanks for raising this issue - it's a case that should definitely be called out in the documentation.