0

I am trying to follow ANCOMBC tutorial at https://bioconductor.org/packages/release/bioc/vignettes/ANCOMBC/inst/doc/ANCOMBC.html

However I got stacked in the beginning, since I was not able to subset the atlas file.

The code is the following:

data(atlas1006)
tse = atlas1006[, atlas1006$time == 0]

And it generates the following Error message:


> Error in h(simpleError(msg, call)) : error in evaluating the argument
> 'j' in selecting a method for function '[': $ operator not defined for
> this S4 class

SecretAgentMan
  • 2,856
  • 7
  • 21
  • 41
Mani
  • 1

1 Answers1

0

"$ operator not defined for this S4 class" may be because your data is saved as an S4 object instead of an S3 object (see here for more details about these object types in R). You can easily test this by using the function:

isS4(atlas1006) where a TRUE output means that it is an S4 object.

You can use the str(atlas1006) or View(altas1006) functions to examine the structure of your data object in more depth. Without being able to see the data, I would at this point recommend trying to access your data by using the @ operator to call a specific slot in your S4 object, which would be roughly equivalent to using atlas1006@time instead of atlas1006$time. If you provide the output you get from using the str(atlas1006) function, I may be able to give you more specific advice.