Re: [R] Package mice: Error in if (meth[j] != "") { : argument is of length zero

From: Joshua Wiley <jwiley.psych_at_gmail.com>
Date: Sat, 09 Apr 2011 23:26:24 -0700

On Fri, Apr 8, 2011 at 2:56 PM, Rita Carreira <ritacarreira_at_hotmail.com> wrote:
>
> Dear R users,
> I am using package mice and I am getting the error "
> Error in if (meth[j] != "") { : argument is of length zero." I have tried using several different versions of R (even the one that will be coming out this month) to no avail. I am using RStudio as my interface with R. Also note that I had run this a couple of days ago and it was working fine; I can't, however, remember the version of R that I was using but it was either R-2.11.1 or R-2.12.1. Please find below my code and error. Any thoughts or ideas?
>
>
>> library(mice)
> # setting up the default settings for the imputation
> ini <- mice(NewPrimal,

Without NewPrimal, we cannot reproduce what you are seeing (this is where small sample datasets are helpful).

>            seed = 52275,
>            method = "norm",
>            maxit=0,
>            pred = quickpred(NewPrimal,
>                   mincor = 0.25,
>                   minpuc = 0.95,
>                   include = c("D1", "D2", "D3",
>                               "Qtr1", "Qtr2", "Qtr3",
>                               "Feb", "Mar", "Apr", "May", "Jun", "Jul",
>                               "Aug", "Sep", "Oct", "Nov", "Dec"),
>                   exclude = c("ActualWeekEndingDate", "Date", "Year")),
>                   print=FALSE)
>
> Error in if (meth[j] != "") { : argument is of length zero

You can get more details right after the error by typing:

traceback()

a quick grep of the mice code suggests the error forcing an exit may occur around line 155. You might be able to do something like:

fix(mice)

and then add a browser() call in somewhere before line 155 and then poke around to get a better sense of what is going on.

Cheers,

Josh

>
> Thank you so very much!
> Rita
>
> ________________________________________
>
> "If you think education is expensive, try ignorance"--Derek Bok
>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 10 Apr 2011 - 06:32:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 10 Apr 2011 - 07:00:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive