[R] subscript out of bounds

David Winsemius dwinsemius at comcast.net
Sat Mar 5 16:36:21 CET 2011


On Mar 5, 2011, at 7:41 AM, Stat Consult wrote:

> On Sat, Mar 5, 2011 at 4:08 PM, Stat Consult  
> <statconsult90 at gmail.com>wrote:
>
>> Dear ALL
>>
>> I cannot run this line
>>
>> stat.obs <- apply (GS, 2, function(z) Hott2(t(DATA[which(z==1),]),  
>> cl))
>>
>> Error in Hott2 (t(DATA[which(z == 1), ]), cl) : subscript out of  
>> bounds
>>
>> I will be glade if you guide me.
>>
>>
>> *******************************************************************************
>>
>> *GS is a matrix 1857*200
>>
>> *DATA is a matrix 1857*79
>>
>> *cl <- as.factor(y)
>>
>>
>> *y<- 
>> *c 
>> (1,0,1,0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0,1,0 
>> *,0,1,1,1,0,1,1,1,1,0,1,0,0,0,1,0,1,1,1,1,0,1,0,1,1)
>>
>> *Hott2 <- function(x, y, var.equal=TRUE)

What were you intending that Hott2 return? At the moment I see no  
function body.

-- 
David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list