Use
cat(sprintf('I did the the %d,%d \n',k,l))
The functions do not print in non interactive mode
Hope it helps
mario
On 16-Feb-11 11:15, Alaios wrote:> Dear all I have an sprintf inside a loop to track changes in variable's
value.
>
> This sprintf statement works if I copy and paste it inside R
> sprintf('I did the the %d,%d \n',k,l)
>
> but when this is inside a loop I get no message.
>
> listcounter<-1
> for (k in c(1:mmax)){ #
> for (l in c(1:nmax)){
>
> lst[[listcounter]]<-fun(estimatedsr)
> listcounter<-listcounter+1
> sprintf('I did the the %d,%d \n',k,l)
> }
> }
>
>
> When I paste the code above I never get any message printed. I know that
the loop works. When I kill the execution of the loop the listcounter variable
has value different from the initial one.
>
> What might be the solution to that strange problem?
>
> Best Regards
> Alex
>
> ______________________________________________
> 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.
--
Ing. Mario Valle
Data Analysis and Visualization Group | http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82