[R] "parallel" package

Uwe Ligges ligges at statistik.tu-dortmund.de
Mon Apr 30 14:18:03 CEST 2012



On 29.04.2012 12:01, ya wrote:
> Hi Uwe and Indrajit,
>
> Thank you very much for the response.
>
> Since we are talking about this package, can I ask more about how to use
> it to deal with statistical issues please?
>
> I have this data with categorical missing values in it. Now I am trying
> to impute them using a function called "mice" from the MICE package.
> Here is the "normal" code:
>
>  > library(mice)
>  > imp=mice(data, m=100) # data was imputed for 100 times which took
> very very long time.
>
> I tried this:
>
>  > library(parallel)
>  > mc=4
>  > run1=do.call(data,mclapply(seq_len(mc),mice(data,m=10)))
> Error in do.call(data, mclapply(seq_len(mc), mice(data, m = 10))) :
> 'what' must be a character string or a function
> In addition: Warning message:
> In mclapply(seq_len(mc), mice(data2, m = 10)) :
> all scheduled cores encountered errors in user code


See ?do.call
1) for the arguments it expects and
2) for what it does - I doubt you need it here.




>
> I have a intel dual core i5 processor, and there are 4 charts in the
> task manager on windows xp(meaning 4 cpus or 4 cores?).

Cores, 2 of them perhaps virtual ones, depends on the Core i5 version.



> However, I
> failed to figure out how to combine the mice function with the package
> "parallel". Any suggestions how I should write the code?

Well, rewriting parts of mice seems to be the only way to let 
collaborate with package parallel.

Best,
Uwe Ligges



>
> Thank you very much.
>
> ya
>
>
>
>
>
>
>
> On 04/29/2012 10:47 AM, Uwe Ligges wrote:
>>
>>
>> On 29.04.2012 09:28, Indr ajit Sengupta wrote:
>>> You don't need quotes in the library statement, you can just use
>>> library(parallel).
>>
>> Yes, a special (mis-)feature of library(). Since we are trying to
>> teach R here, we should provide clean R code. In an ideal world, we
>> would be able to say
>>
>> pkg <- "parallel"
>> library(pkg)
>>
>> doing the same as
>>
>> library("parallel")
>>
>> which is unfortunately not possible, because library(pkg) tries a
>> package called "pkg".
>>
>> Best,
>> Uwe Ligges
>>
>>
>>
>>>
>>> Regards,
>>> Indrajit
>>>
>>>
>>>
>>> ________________________________
>>> From: Uwe Ligges<ligges at statistik.tu-dortmund.de>
>>> To: ya<xinxi813 at 163.com>
>>> Cc: r-help at r-project.org
>>> Sent: Saturday, April 28, 2012 11:57 PM
>>> Subject: Re: [R] "parallel" package
>>>
>>>
>>>
>>> On 28.04.2012 20:18, ya wrote:
>>>> Hi everyone,
>>>>
>>>> Anyone knows Where I can get the "parallel" package? The google results
>>>> said this package has been released since R 2.14, but I could not
>>>> find a
>>>> place to get it.
>>>>
>>>> I am doing a multiple imputation for missing values, it is really time
>>>> consuming. I figured maybe it's more efficient by paralleling my CPU. I
>>>> got an intel dual core i5 processor in a Thankpad x201 laptop. And I
>>>> have used install.packages ("parallel") in R 2.15 on both linux and
>>>> windows xp, no package installed. So maybe this package is not on cran?
>>>> Any idea?
>>>
>>> It is shipped as an R base packaage. Just use
>>>
>>> library("parallel")
>>>
>>> Uwe Ligges
>>>
>>>
>>>> Thank you very much.
>>>>
>>>> ya
>>>>
>>>> ______________________________________________
>>>> 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.
>>>
>>> ______________________________________________
>>> 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.
>
>



More information about the R-help mailing list