[R] Mclapply and print statement
Steve Lianoglou
mailinglist.honeypot at gmail.com
Mon Apr 11 19:13:00 CEST 2011
Hi,
On Mon, Apr 11, 2011 at 5:26 AM, Alaios <alaios at yahoo.com> wrote:
> Dear all.
> I am using the mclapply function to split my code to the many cores my system has. It seems that is working fine. This is the parallel version of lcapply.
>
> The only problem that I seem to have is that the printf cannot print messages.
>
> The ideal to me is to have fro my function an output of the form
> Shadowlist<-mclapply(1:dimz, function(i) {
> print(sprintf('Creating the %d map',i));
> GaussRF(x=x, y=y, model=model, grid=TRUE,param=c(mean,variance,nugget,scale,Whit.alpha))
> }
> )
>
> 'I am the processor %d and I work with the task %d',processorid,i
>
> So far I get not output from my print(sprintf(... function.
>
> What do you think I should try out?
Use `cat`:
R> x <- mclapply(1:20, function(i) cat(i, "\n"))
1
9
17
2
10
18
3
11
19
4
12
20
5
13
6
14
7
15
8
16
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the R-help
mailing list