Bioconductor/BiocGenerics

as.data.frame generic for signature DataFrame

Closed this issue · 1 comments

I am building a package for bioconductor that works with singleCellExperiment objects and I have come across an issue with the conversion from DataFrame to data.frame. Specifically, because column names of a matrix can be duplicated, the row names of colData(sce) which are stored as a DataFrame can also be duplicated. The conversion to data.frame via the as.data.frame method always produces valid rownames via make.unique.

My issue (really an enhancement request) is that I would like this particular situation to throw an error by supplying the make.names = FALSE to as.data.frame, unfortunately all ... are ignored by the current version of the method. As I'm aware that handling some but not all ... arguments would cause confusion, I would like to request that make.names be exposed which would match the base S3 method for class 'matrix'.

hpages commented

IIUC this is about the behavior of the as.data.frame() method for DataFrame objects which is defined in the S4Vectors package. The BiocGenerics package only defines the as.data.frame() S4 generic with setGeneric("as.data.frame", signature="x"). That's all it does.

Please open an issue in the S4Vectors repository (here) for this, and provide a reproducible example that shows the problem (with your sessionInfo()).

FWIW you can see the definition of the as.data.frame() method for DataFrame objects with selectMethod("as.data.frame", "DataFrame") after loading the S4Vectors package.

Best,
H.