I want to subset my object object
based on names in by object, and plot each subset. The subsetting is defined in idents
like for example idents ="T-cell"
and need to be specified with quotes. How do I set the quotes from the for-loop=?
for (i in names(table(Idents(object))))
{
subset.out <- subset(x = object, idents = "i") #i there is the problem
DimPlot(subset.out)
}
My solution in the end:
ids <- names(table(Idents(object)))
for (i in 1:length(celltypes)) {
subset.out <- subset(x = object, idents =ids[i])
print(DimPlot(subset.out))
}