[R] error message

Peter Ehlers ehlers at ucalgary.ca
Wed Jan 19 00:01:00 CET 2011


On 2011-01-18 13:06, wangwallace wrote:
>
> I tried it several times. it still gives me the same error.
>
> I also used traceback()
>
> here is what I got:
>
>> traceback()
> 3: `[.data.frame`(df, -s1$SubID, )
> 2: df[-s1$SubID, ]
> 1: crossed1(agr)
>
> But I don't think there is anything wrong with it......

I think there is. Try this:

  d <- data.frame(x=1:5, id1=5:1, id2=-2:2)
  d
  d[d$id1,]
  d[-d$id1,}
  d[-d$id2,]

So I think you'd better check your SubID contents.
It looks as though you're getting both positive and
negative values.

Peter Ehlers



More information about the R-help mailing list