[R] LCA (e1071 package): error

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Thu Jan 15 16:58:34 CET 2009


> I will use the lca method in the e1071 package. But I get the following 
error:
> Error in pas[j, ] <- drop(exp(rep(1, nvar) %*% log(mp))) :
>   number of items to replace is not a multiple of replacement length
> 
> Does anybody know this error and knows what this means?

The error means that you are trying to assign a variable of one size to a 
variable of another fixed size.  An example that recreates it is:
x <- matrix(1:6, nrow=3)
x[1,] <- 1:10

x[1,] cannot be resized from 3 to 10 without affecting the rest of x, so 
an error is thrown.

In your example, the jth row of the matrix pas is a different size from 
drop(exp(rep(1, nvar) %*% log(mp))).

Since you haven't provided a reproducible example (tut tut, read the 
posting guide) you'll have to do the debugging yourself.

To get you started, type traceback() to see where the problem occurs.

Now try options(error=recover), and call the lca function again.  Now you 
can examine the values of nvar, mp and pas to see what is going wrong.

Regards,
Richie.

Mathematical Sciences Unit
HSL



------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}




More information about the R-help mailing list