[R] Weird error: Error in xj[i] : invalid subscript type 'list'

Karl Ove Hufthammer karl at huftis.org
Thu Oct 29 17:45:50 CET 2009


On Thu, 29 Oct 2009 11:28:44 -0500 Peng Yu <pengyu.ut at gmail.com> wrote:
> 
> I got the error. I haven't been able to get a stand along case so that
> I can show it here. But could somebody give some clue on what could
> cause this error? Since I never defined xj[i], I don't understand
> where this error come from.
> 
> Error in xj[i] : invalid subscript type 'list'

You use a function which extracts subsets of an object, but the indices 
happens to be a list. Example:

x=1:5
z=as.list(1:2)
x[z]

-- 
Karl Ove Hufthammer




More information about the R-help mailing list