progress bar showing C code's progress

51 views
Skip to first unread message

AustinD

unread,
Jan 4, 2016, 4:00:37 PM1/4/16
to Shiny - Web Framework for R
Hello,

Thanks in advance for any help.  I have a C code that is invoked (via system command) from R code running on Shiny server.  The C code takes minutes to do its calculation.  I am thinking of having C code regularly write a "count" to a text file and R code reads the text file then convert the info to progress bar.  I think if I invoke the C code via "system" with "wait = FALSE",  perhaps this will work?

Thanks.

Joe Cheng

unread,
Jan 4, 2016, 4:05:46 PM1/4/16
to AustinD, Shiny - Web Framework for R
Yeah, I think that should work. You might consider using reactiveFileReader to monitor the file.

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/552632a5-f661-4330-90d9-7ce596dbaef8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

AustinD

unread,
Jan 4, 2016, 4:59:05 PM1/4/16
to Shiny - Web Framework for R
As usuall, thanks Joe for your prompt reply. 

How can I show progress if I compile the C code as shared lib and have R code calling the C function via ".c" or ".call"?  I think R (and shiny) won't get control to display progress until C code is done.  Wait, but in this case,  can I have C code calls R code to display progress?

Thanks again.

Joe Cheng

unread,
Jan 4, 2016, 6:01:42 PM1/4/16
to AustinD, Shiny - Web Framework for R
I usually use Rcpp, not raw C, so I don't know exactly how to call R from C--but I believe eval should do it. I would try to pass a closure from R to C that does the right thing.

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.

Joe Cheng

unread,
Jan 4, 2016, 6:04:21 PM1/4/16
to AustinD, Shiny - Web Framework for R
(Sorry, hit Send too soon.)

You might be able to just call setProgress from C using eval, actually. That might work.

If all else fails you could break up the C code into multiple discrete functions and have R call them individually.
Reply all
Reply to author
Forward
0 new messages