I have an S4 object 'DATA' with three slots - the structure looks like this (sorry, I don't know how to create an example, so this a simplified structure of what I'm working with)
---Coordinates: @coo (e.g. 'Name_A') is a 2x20 matrix where, there are 6 matrices with names
---Names: @names Name_A Name_B Name_C Name_D Name_E Name_F and each Name has one of two Factors
---Factors: @fac Factor_A Factor_B
How do I subset (select) @coo data where @fac = Factor_A? I've tried a numer of combinations of dataframe type selections using [] notation with getElement but this is clearly not correct. Thanks.
EDIT Repeatable example - this is a horrific way of doing this I know....
library(Momocs)
The input data file you read in looks like this (called "test.chc", where this is the output from another application)
[1] "sampleA 322 6 5 4 4 4 4 4 6 5 4 4 4 6 0 0 0 6 6 4 6 5 4 4 4 4 3 2 4 3 2 4 4 -1"
[2] "sampleB 231 5 4 4 4 4 4 4 6 5 4 4 4 6 0 0 0 6 6 4 6 5 4 4 4 4 3 2 4 3 2 4 4 -1"
[3] "sampleC 489 6 5 4 4 4 4 4 6 5 4 4 4 6 0 0 0 6 6 4 6 5 4 4 4 4 3 2 4 3 2 4 4 -1"
[4] "sampleD 323 6 5 4 4 4 4 4 6 5 4 4 4 6 0 0 0 6 6 4 6 5 4 4 4 4 3 2 4 3 2 4 4 -1"
[5] "sampleE 381 6 5 4 4 4 4 4 6 5 4 4 4 6 0 0 0 6 6 4 6 5 4 4 4 4 3 2 4 3 2 4 4 -1"
[6] "sampleF 342 6 5 4 4 4 4 4 6 5 4 4 4 6 0 0 0 6 6 4 6 5 4 4 4 4 3 2 4 3 2 4 4 -1"
[7] "sampleG 327 6 5 4 4 4 4 4 6 5 4 4 4 6 0 0 0 6 6 4 6 5 4 4 4 4 3 2 4 3 2 4 4 -1"
[8] "sampleH 336 6 5 4 4 4 4 4 6 5 4 4 4 6 0 0 0 6 6 4 6 5 4 4 4 4 3 2 4 3 2 4 4 -1"
[9] "sampleI 147 6 5 4 4 4 4 4 6 5 4 4 4 6 0 0 0 6 6 4 6 5 4 4 4 4 3 2 4 3 2 4 4 -1"
[10] "sampleJ 654 6 5 4 4 4 4 4 6 5 4 4 4 6 0 0 0 6 6 4 6 5 4 4 4 4 3 2 4 3 2 4 4 -1"
and
grps<- data.frame(Groups=(rep(letters[1:2],5)))
c.S4obj <-chc2Coo("test.chc")
c.S4obj@fac <-grps
str(c.S4obj)
So, the question is, how to select data for a specific group (a or b) and return an S4 class object?