I am using the subset function from Seurat to filter the genes present in the Seurat object as follows:
sample <- subset(sample, features = keep)
This works fine in RStudio, however when I run several samples in a loop using the
rmarkdown::render() command, my code crashes on the second sample (the first sample runs completely fine) with the error:
Error in data[data_types == l, , drop = FALSE] : object of type 'S4' is not subsettable Calls: <Anonymous> ... withVisible -> eval -> eval -> Read10X -> lapply -> FUN
I presume it is trying to use the wrong
subset function, but I am not sure why and I am also struggling to work out how to explicitly call the Seurat subset function.
SeuratObject::subset() but it says the subset is not exported from the SeuratObject package. I have saved the
sample object and it is definitely a Seurat object.
Any help would be greatly appreciated.