[R] Rprintf not updating

Erik Wright eswright at wisc.edu
Tue Apr 6 01:30:30 CEST 2010

Hi Charlie,

Thanks, I got it working by looking at your myRunIfConcise function.

SEXP changePercent(SEXP pBar)
	int *rPercentComplete;
	SEXP utilsPackage, percentComplete;
	PROTECT(utilsPackage = eval(lang2(install("getNamespace"), ScalarString(mkChar("utils"))), R_GlobalEnv));
	*rPercentComplete = 10; //this value increments
	eval(lang4(install("setTxtProgressBar"), pBar, percentComplete, R_NilValue), utilsPackage);

Now I am wondering why the pBar doesn't show initially if the percent complete is 0%?

Thanks again,

On Apr 5, 2010, at 4:00 PM, Sharpie wrote:

> Erik Wright wrote:
>> Hi Charlie,
>> I like your idea of updating an R progress bar from C, but I don't at all
>> understand how to call txtProgressBar from C.  I have looked at Writing R
>> Extensions and it is equally confusing.  Any help would be appreciated.
>> Thanks!,
>> Erik
> Hi Erik,
> Did you look at the link I put in my last post?
> http://n4.nabble.com/Writing-own-simulation-function-in-C-td1580190.html#a1580423
> I linked that post because it gives a step-by-step example for performing a
> callback to the runif function from C.  Just  change the execution
> environment from stats to utils and alter the function arguments
> appropriately and it should work for txtProgressBar and setTxtProgressBar.
> -Charlie
> -----
> Charlie Sharpsteen
> Undergraduate-- Environmental Resources Engineering
> Humboldt State University
> -- 
> View this message in context: http://n4.nabble.com/Rprintf-not-updating-tp1751703p1752102.html
> Sent from the R help mailing list archive at Nabble.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.

More information about the R-help mailing list