目的:创建循环变量名"xxx.pdf" ,其中xxx是基因名
eg:gene=c("gene1","gene2",......)
class(gene) --->character
参考:paste0("A", 1:5)
引申:paste0(gene[i],".pdf")
实现:
for (i in 1:length(gene)){
# i=1
p=FeaturePlot(scRNA, features = gene[i]) ##scRNA为单细胞对象
ggsave(p,filename = paste0(gene[i],".pdf"))
}
网友评论