[R] R-Help : running MIX package

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Fri Jan 28 13:13:03 CET 2005


On 28-Jan-05 Ted Harding wrote:
> On 28-Jan-05 Jeanhee Hong wrote:
>> Hello all. I am inexperienced with  R and am clumsily trying to work
>> through it for specific multiple imputations Id like to run for my
>> thesis.In running the MIX package, I keep getting an error message
>> regarding the use of the prelim.mix command. 
>>  
>> Error in as.integer.default(list(alcohol = c(1, 1, 1, 1, 1, 1, 1, 1,
>> 1,
>>: 
>>         (list) object cannot be coerced to integer
>> [...]
> [...]
> So make sure that x is indeed a *matrix* and not some other R
> structure (which may, e.g. a data-frame, look like a matrix but
> isn't one). 'matrix' is a very specific data structure in R,
> and is not to be confused with other structures which may look
> like matrices.
> [...]

By experiment I have confirmed my guess: with X a dataframe
(30 rows, 4 cols of which the first two categorical) I get
exactly the same error message as you with

  prelim.mix(X,2)

whereas, after

  x <- as.matrix(X)
  prelim.mix(x,2)

everything is fine . Note that both

  X

and

  x

give outputs which look exactly the same, though they are not
the same kind of object. Only 'x' will do for prelim.mix!

Cheers,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
Date: 28-Jan-05                                       Time: 12:13:03
------------------------------ XFMail ------------------------------




More information about the R-help mailing list