Comments (19)
Confirmed.
from progress.
Should be fixed by b1efa6b
from progress.
@gaborcsardi I have installed the dev version of this package but it doesn't display the progress bar using my example code above.
from progress.
This works for me. What is your platform? Is this the latest progress version?
from progress.
@gaborcsardi Windows 7 X64. The progress version is the latest on Github, installed via devtools::install_github('r-lib/progress')
(I even checked the installed RProgress.h
header file, it's the same as in Github). For details, please see the session info below.
> devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 3.4.4 (2018-03-15)
os Windows 7 x64 SP 1
system x86_64, mingw32
ui RStudio
language (EN)
collate Chinese (Simplified)_People's Republic of China.936
tz Asia/Taipei
date 2018-04-25
─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date source
ansistrings 1.0.0.9000 2018-04-13 Github (r-lib/ansistrings@4e4d309)
assertthat 0.2.0 2017-04-11 CRAN (R 3.4.4)
backports 1.1.2 2017-12-13 CRAN (R 3.4.3)
cli 1.0.0.9002 2018-04-13 Github (r-lib/cli@c408924)
clisymbols 1.2.0 2017-05-21 CRAN (R 3.4.1)
crayon 1.3.4 2017-09-16 CRAN (R 3.4.1)
DBI 0.8 2018-03-02 CRAN (R 3.4.4)
desc 1.1.1 2017-08-03 CRAN (R 3.4.1)
devtools 1.13.5.9000 2018-04-08 local
digest 0.6.15 2018-01-28 CRAN (R 3.4.3)
glue 1.2.0 2017-10-29 CRAN (R 3.4.2)
hms 0.4.2 2018-03-10 CRAN (R 3.4.4)
magrittr 1.5 2014-11-22 CRAN (R 3.4.4)
memoise 1.1.0 2017-04-21 CRAN (R 3.4.0)
pkgbuild 0.0.0.9000 2017-12-06 Github (r-lib/pkgbuild@ce7f6d1)
pkgconfig 2.0.1 2017-03-21 CRAN (R 3.4.4)
pkgload 0.0.0.9000 2017-12-06 Github (r-lib/pkgload@70eaef8)
prettyunits 1.0.2 2015-07-13 CRAN (R 3.4.1)
progress 1.2.0 2018-04-23 Github (r-lib/progress@a2678e8)
R6 2.2.2 2017-06-17 CRAN (R 3.4.1)
Rcpp * 0.12.16 2018-03-13 CRAN (R 3.4.4)
rlang 0.2.0 2018-02-20 CRAN (R 3.4.3)
rprojroot 1.3-2 2018-01-03 CRAN (R 3.4.3)
rstudioapi 0.7.0-9000 2018-04-13 Github (rstudio/rstudioapi@e87b481)
selectr 0.4-1 2018-04-06 CRAN (R 3.4.4)
sessioninfo 1.0.1.9000 2017-12-06 Github (r-lib/sessioninfo@c871d01)
stringi 1.1.7 2018-03-12 CRAN (R 3.4.4)
stringr 1.3.0 2018-02-19 CRAN (R 3.4.3)
testthat 2.0.0 2017-12-13 CRAN (R 3.4.4)
usethis * 1.3.0 2018-02-24 CRAN (R 3.4.3)
withr 2.1.2 2018-03-15 CRAN (R 3.4.4)
xml2 1.2.0 2018-01-24 CRAN (R 3.4.3)
yaml 2.1.18 2018-03-08 CRAN (R 3.4.4)
from progress.
@gaborcsardi I did a simple debug. all the three functions below always return 0.
progress/inst/include/RProgress.h
Line 278 in a2678e8
Moreover, even I force the is_r_studio()
to return true
(I test this in the Rstudio IDE), the progress bar won't be print, either... I don't know why.
Thanks.
from progress.
What's your rstudio version?
from progress.
Version 1.1.423
from progress.
What' more, I just confirmed that it won't work for the RGui either.
from progress.
Yeah, looking at the code, RGui is expected I think. But RStudio should work. What is your RSTUDIO
environment variable set to?
Sys.getenv("RSTUDIO")
from progress.
It's "1"
. However, I tried in cpp using std::getenv("RSTUDIO")
will get empty.
Example
Rcpp::cppFunction('void test() {
char *v = std::getenv("RSTUDIO");
Rcpp::Rcout << (v == 0);
}')
test()
# returns 1 meaning it's empty. By contrast, if you change ”RSTUDIO" to "PATH", it returns 0.
Moreover,
I find if I change the %
of the below line to anything else like abcd
, it gets worked in the CMD console.
progress/inst/include/RProgress.h
Line 128 in a2678e8
So,
- don't know why
std::getenv("RSTUDIO")
returns empty in the Rstudio IDE (even thoughSys.getenv("RSTUDIO")
returns "1")... - don't know why if a
std::string
contains%
, theRprintf(str.c_str())
will print nothing.
from progress.
The example to my second point (change %
to %%
will solve the problem but I don't know why it's not needed on the OSX):
Rcpp::cppFunction('void test2() {
std::string a = "abcd";
std::string b = "efgh%";
Rprintf(a.c_str());
Rprintf(b.c_str());
}')
test2()
# abcdWarning message:
# In test2() : printing of extremely long output is truncated
from progress.
Oh, yeah, there is a bug here. The %
is interpreted in Rprintf()
or REprintf
. I'll fix that.
But that's independent of the RSTUDIO
env var being unset. That is just strange. It seems like a windows specific thing. Wow.
from progress.
I'll think about how to detect RStudio from C++ code then....
from progress.
Looks like a bunch of other env vars are there from C as well:
RSTUDIO_WINUTILS=C:/Program Files/RStudio/bin/winutils
RSTUDIO_PANDOC=C:/Program Files/RStudio/bin/pandoc
RMARKDOWN_MATHJAX_PATH=C:/Program Files/RStudio/resources/mathjax-26
RSTUDIO_MSYS_SSH=C:/Program Files/RStudio/bin/msys-ssh-1000-18
This might be an RStudio bug then?
from progress.
Looks like that if you set the variable explicitly with Sys.setenv(RSTUDIO = "1")
then it will be there in C++ as well?
from progress.
Yes, you are right. Calling Sys.setenv(RSTUDIO = "1")
solves this. I don't really know why's that. Maybe a bug from the RStudio side?
from progress.
Maybe, but I don't know how that would be even possible. It is R calling the external code via .Call
, RStudio has nothing to do with it AFAICT. Anyway, I asked the RStudio IDE team, will let you know.
I'll fix the other bugs as well, the %
one, and the detection of RGui and R.app
from progress.
Thanks!
from progress.
Related Issues (20)
- A BSD-like progress indicator HOT 2
- Add :etafull
- progress bar does not show up when sourcing script as local job in RStudio HOT 2
- Support for multi-line output HOT 3
- Can we have an "appendLF" option in the message() method? HOT 4
- `tick(0)` doesn't show progress bar. HOT 5
- Progress bar with download rates? HOT 2
- progress is not updating the progress bar on a single line HOT 5
- testthats of new packages fail with R CMD CHECK HOT 2
- Error when total = NA and format contains :bar HOT 1
- Add class and data to message condition HOT 1
- A etafull token HOT 1
- total=0: error due to ratio = NaN
- WISH: pb$tick(skip = TRUE) to tell ETA that we're skipping a step HOT 1
- IS there a way to show every nth tick? HOT 2
- Crayon usage in format argument breaks progress bar updating HOT 6
- Supersede in favor of cli::cli_progress_bar and co.
- Move `master` branch to `main` HOT 1
- Progress to convergence not to iterations HOT 1
- Showing progress bar in pane "background job" in RStudio HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from progress.