R: lapply is not working for this subsetting

I am working in creating a class and applying its own methods. I create a class like this:


and now that I have it in "LongitudinalData" I want to apply a method of this class which subset a member of the ID (ie 14) and return the data (all variables ) for this particular ID. I am doing that by this:

subject.LongitudinalData<-function(data, n=c(14, 20, 41, 44, 46, 54, 64, 74, 104, 106)) 
    {structure(lapply(data, function(x) x[which (data$id==n)]),
                    class = c("subject", "LongitudinalData", "data.frame"))}

The problem is that when I want to see the data for ie subject(ss, 14) it did not return me nothing.

I dont know what i am doing wrong...

If I do str(subject(ss, 14)) it gives me back the structure but if I apply: dim(subject(ss,14)) it gives me back: [1] 0 5

Another try is when I applied split ie:

ss.by.condition <- split(ss, ss$room)  where ss<-subject(ss,14)

It gives me back: Error in x$id[[c(1)]] : subíndice fuera de los límites

What is going on?? what is the problem??