This simple for loop I want it to run the function FindMarkers, which will take as an argument a data identifier (1,2,3 etc..) that it will use to pull data from. I then want it to store the result of the function in immunes.i, where I want I to be the same integer (1,2,3)
So I want an output of 15 files names immunes.0, immunes.1, immunes.2 etc...
Right now Im getting an error though; here is the code:
for (i in 0:14){
immunes.i <- FindMarkers(AllCells.combined, ident.1 = "VEH", ident.2 = "IMQ", verbose = TRUE, group.by="stim", subset.ident = "i")
}
The error i get is "Error in WhichCells.Seurat(object = x, cells = cells, idents = idents, :
Cannot find the following identities in the object: i"
If I run the last line by itself it works perfectly, namely:
immunes.0 <- FindMarkers(AllCells.combined, ident.1 = "VEH", ident.2 = "IMQ", verbose = TRUE, group.by="stim", subset.ident = "0")
any advice? I want to use i as a variable within the loop but I don't know the right syntax or way to do it....