Peng Yu
2009-Oct-29 16:28 UTC
[R] Weird error: Error in xj[i] : invalid subscript type 'list'
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'
Karl Ove Hufthammer
2009-Oct-29 16:45 UTC
[R] Weird error: Error in xj[i] : invalid subscript type 'list'
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
David Winsemius
2009-Oct-29 16:46 UTC
[R] Weird error: Error in xj[i] : invalid subscript type 'list'
On Oct 29, 2009, at 12:28 PM, Peng Yu 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' >This reminds me of the stories told by guys coming into emergency rooms who have been involved in fights: "I was just sitting on the corner, minding my own business, when I was attacked by this error". > xj <- 1:4 > xj[list(1,2)] Error in xj[list(1, 2)] : invalid subscript type 'list' -- David Winsemius, MD Heritage Laboratories West Hartford, CT
Duncan Murdoch
2009-Oct-29 17:13 UTC
[R] Weird error: Error in xj[i] : invalid subscript type 'list'
On 10/29/2009 12:28 PM, Peng Yu 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'Next time you see it, run traceback() afterwards to see which function triggered it. That might help you to track it down and fix it. Duncan Murdoch