Skip to content
Prev 285621 / 398502 Next

(subscript) logical subscript too long in using apply

On Fri, Feb 17, 2012 at 12:44:44PM +0100, Soheila Khodakarim wrote:
Hi.

Without a reproducible example, it is hard to determine
the problem. You can try  options(error=utils::recover)
to get more information on the values of the variables
when the error occurs.

However, i am not sure, why you use data[which(z==1),]
and not data[,which(z==1)]. The reason is that the
function "apply(gs , 1 , func)" applies "func" to the
rows of "gs". These rows have length 2665, which is equal
to the number of columns of "data". So, i would expect
to use "z" to select columns, not rows of "data". Can you
comment on this?

Petr Savicky.