Remove column from Seurat metadata
2
0
Entering edit mode
19 months ago
gorizwango ▴ 30

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 • 3.3k views
ADD COMMENT
1
Entering edit mode
19 months ago

Try setting it to NULL.

seu$percent.globin <- NULL
ADD COMMENT
0
Entering edit mode

Thanks for the help mate. it worked.

ADD REPLY
0
Entering edit mode
3 months ago
ev97 ▴ 40

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))]
ADD COMMENT

Login before adding your answer.

Traffic: 2542 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6