This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Remove column from Seurat metadata

How can I remove a particular entry in my metadata table in Seurat? Like I have a dataframe named seu which has different objects assessed through @, and in each object we have several entries which can assessed through $.

seu@meta.data[["percent.globin"]]

So, if I need to remove an entry inside metadata object, how can I do that?

single-cell transcriptomics cell-type-annotation rnaseq

2 answers

Try setting it to NULL.

seu$percent.globin <- NULL

Thanks for the help mate. it worked.

Just in case someone reaches this post with the same question but they need to remove several columns with a particular pattern (e.g.: RNA_snn_res.0.1, RNA_snn_res.0.2, RNA_snn_res.0.3...), you can use this code:

seu@meta.data <- seu@meta.data[, !grepl("RNA_snn_res", colnames(seu@meta.data))]

Log in to answer this question.