Entering edit mode
21 months ago
Chris
▴
340
Hi all,
Would you suggest why I got this error when running the code below:
obj.list <- SplitObject(merged_seurat, split.by = "condition")
for(i in 1:length(obj.list)){
obj.list[[i]] <- NormalizeData(object = obj.list[[i]])
obj.list[[i]] <- FindVariableFeatures(object = obj.list[[i]])
Error in FindVariableFeatures(object = obj.list[[i]]) :
object 'i' not found
Thank you so much!
This is a basic R error. You probably have a copy paste error - check if you have the
{
after the for and if you do, ensure you don't have the corresponding}
immediately after theNormalizeData
call.Hi Ram, I run that code in a chunk in Rmarkdown so I have used
{}
like this:So how can I overcome this issue?
I think for debugging purposes, you should try running just the R code fragments one after another. If they all work fine, the problem is in the way the segments are added to the Rmd. If not, you'll run into problems while testing and that'll tell you what the underlying issue is.