It loads them in a SingleCellExperiment object. From here you have a few options.
1) You can save the entire object as an h5ad file using zellkonverter, which can be opened directly using scanpy in python. I recommend this method because it will also transfer all of the feature and sample metadata.
|> is the native pipe in R but only available in versions 4+. You could use the pipe in magrittr %>% or rewrite the command using nested functions instead of the pipe.
It's possible, but imho not recommended for three reasons. 1) You should use getter functions rather than directly accessing the slots in a SingleCellExperiment (or any container format), here that would be counts() or assay() as suggested above. Reason is that if the structure of the format changes in future versions of the package your manual accession of the data might not work anymore while the getter function will always work as the developer simply changes the internal code of the getter but for the end user it stays the same. 2) the as.data.frame expands the compressed/sparse matrix of counts to an ordinary one, and for large datasets that might blow up your memory. In any case, it uses unncessarily much memory. For this simple example here it's fine what you do, but in general using getters and leaving sparse/compressed data as such is imho a good practice to get used to, which is what the code snipped of rpolicastro does. 3) A plain csv is larger than the compressed mtx format which saves disk space, though both can be gzipped to further reduce size.
Thank you very much for your answer !
For the third option I got an error message: "Error in parse(text = x, srcfile = src): <text>:4:13: unexpected '>' 3: 4: assay(sce) |>"
Would you mind to comment, please ?
|>
is the native pipe in R but only available in versions 4+. You could use the pipe in magrittr%>%
or rewrite the command using nested functions instead of the pipe.