dcomtois / summarytools

R Package to Quickly and Neatly Summarize Data
523 stars 78 forks source link

dfSummary() using ASCII art on RedHat 7 - X11 issue #102

Closed jrisi256 closed 4 years ago

jrisi256 commented 4 years ago

Thanks for making such a great package!

I am having an issue where when I use dfSummary() on a data frame, ASCII art is used in the "Graph" column.

dfSummary(mtcars)

Warning : In png(png_loc <- tempfile(fileext = ".png"), width = 150 *  ... : unable to open connection to X11 display ''

I also tried using it within a markdown document and had a similar issue.

dfSummary(mtcars)
Warning (Markdown): 'tmp.img.dir' will be ignored since system has no X11 capabilities

After some searching around, I realized because I'm using Red Hat 7, X11 was not available.

capabilities()
       jpeg         png        tiff       tcltk         X11        aqua    http/ftp     sockets      libxml        fifo      cledit       iconv         NLS 
       TRUE        TRUE        TRUE        TRUE       FALSE       FALSE        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
    profmem       cairo         ICU long.double     libcurl 
       TRUE        TRUE        TRUE        TRUE        TRUE 

Some further searching suggested I use ssh tunneling to connect to an X11 device. However, I don't have the ability to do that.

Is there anything you could recommend to help fix this issue? Thanks.

EDIT: I also tried using an earlier version of summarytools (version 0.8.8), and this also did not work.

Below is my session info:

devtools::session_info()

─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

setting  value                                     

 version  R version 3.6.0 (2019-04-26)              

 os       Red Hat Enterprise Linux Server 7.7 (Maipo)

system   x86_64, linux-gnu                         

 ui       RStudio                                   

 language (EN)                                      

 collate  en_US.UTF-8                               

 ctype    en_US.UTF-8                               

 tz       America/New_York                          

 date     2019-12-16                                

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

package      * version   date       lib source                               

 abind          1.4-5     2016-07-21 [2] CRAN (R 3.6.0)                       

 arm            1.10-1    2018-04-13 [2] CRAN (R 3.6.0)                       

 assertthat     0.2.1     2019-03-21 [2] CRAN (R 3.5.2)                       

 backports      1.1.4     2019-04-10 [2] CRAN (R 3.5.2)                       

 bit            1.1-14    2018-05-29 [2] CRAN (R 3.5.2)                       

 bit64          0.9-7     2017-05-08 [2] CRAN (R 3.5.2)                       

 bitops         1.0-6     2013-08-17 [2] CRAN (R 3.5.2)                        

 blob           1.2.0     2019-07-09 [2] CRAN (R 3.6.0)                       

 boot           1.3-23    2019-07-05 [3] CRAN (R 3.6.0)                       

 broom          0.5.2     2019-04-07 [2] CRAN (R 3.6.0)                       

 callr          3.3.2     2019-09-22 [2] CRAN (R 3.6.0)                       

 cellranger     1.1.0     2016-07-27 [2] CRAN (R 3.5.2)                       

 checkmate      1.9.4     2019-07-04 [2] CRAN (R 3.6.0)                       

 chron          2.3-54    2019-08-26 [2] CRAN (R 3.6.0)                       

 cli            1.1.0     2019-03-19 [2] CRAN (R 3.5.2)                       

 coda           0.19-3    2019-07-05 [2] CRAN (R 3.6.0)                       

 codetools      0.2-16    2018-12-24 [3] CRAN (R 3.6.0)                       

 colorspace     1.4-1     2019-03-18 [2] CRAN (R 3.5.2)                       

 crayon         1.3.4     2017-09-16 [2] CRAN (R 3.5.2)                       

 curl           4.2       2019-09-24 [2] CRAN (R 3.6.0)                       

 data.table   * 1.12.2    2019-04-07 [2] CRAN (R 3.6.0)                       

 DBI            1.0.0     2018-05-02 [2] CRAN (R 3.6.0)                       

 desc           1.2.0     2018-05-01 [2] CRAN (R 3.5.2)                        

 devtools     * 2.2.1     2019-09-24 [2] CRAN (R 3.6.0)                       

 digest         0.6.21    2019-09-20 [2] CRAN (R 3.6.0)                       

 dplyr        * 0.8.3     2019-07-04 [2] CRAN (R 3.6.0)                       

 eeptools     * 1.2.2     2019-03-19 [1] CRAN (R 3.6.0)                       

 ellipsis       0.3.0     2019-09-20 [2] CRAN (R 3.6.0)                       

 fansi          0.4.0     2018-10-05 [2] CRAN (R 3.5.2)                       

 forcats      * 0.4.0     2019-02-17 [2] CRAN (R 3.6.0)                       

 foreign        0.8-72    2019-08-02 [3] CRAN (R 3.6.0)                       

 fs             1.3.1     2019-05-06 [2] CRAN (R 3.5.2)                       

 generics       0.0.2     2018-11-29 [2] CRAN (R 3.5.2)                       

 ggplot2      * 3.2.1     2019-08-10 [2] CRAN (R 3.6.0)                       

 glue           1.3.1     2019-03-12 [2] CRAN (R 3.6.0)                       

 gsubfn       * 0.7       2018-03-16 [2] CRAN (R 3.5.2)                       

 gtable         0.3.0     2019-03-25 [2] CRAN (R 3.5.2)                       

 haven        * 2.1.1     2019-07-04 [2] CRAN (R 3.6.0)                       

 hms            0.5.1     2019-08-23 [2] CRAN (R 3.6.0)                        

 htmltools      0.3.6     2017-04-28 [2] CRAN (R 3.5.2)                       

 httr           1.4.1     2019-08-05 [2] CRAN (R 3.6.0)                       

 jsonlite       1.6       2018-12-07 [2] CRAN (R 3.6.0)                       

 lattice        0.20-38   2018-11-04 [3] CRAN (R 3.6.0)                       

 lazyeval       0.2.2     2019-03-15 [2] CRAN (R 3.5.2)                       

 lifecycle      0.1.0     2019-08-01 [2] CRAN (R 3.6.0)                       

 lme4           1.1-21    2019-03-05 [2] CRAN (R 3.6.0)                       

 lmtest         0.9-37    2019-04-30 [2] CRAN (R 3.6.0)                       

 lubridate    * 1.7.4     2018-04-11 [2] CRAN (R 3.6.0)                        

 magick         2.2       2019-08-26 [2] CRAN (R 3.6.0)                       

 magrittr       1.5       2014-11-22 [2] CRAN (R 3.6.0)                       

 maptools       0.9-5     2019-02-18 [2] CRAN (R 3.6.0)                        

 MASS           7.3-51.4  2019-03-31 [3] CRAN (R 3.6.0)                       

 Matrix         1.2-17    2019-03-22 [3] CRAN (R 3.6.0)                       

 matrixStats    0.55.0    2019-09-07 [2] CRAN (R 3.6.0)                       

 memoise        1.1.0     2017-04-21 [2] CRAN (R 3.5.2)                       

 minqa          1.2.4     2014-10-09 [2] CRAN (R 3.6.0)                       

 modelr         0.1.5     2019-08-08 [1] CRAN (R 3.6.0)                       

 munsell        0.5.0     2018-06-12 [2] CRAN (R 3.5.2)                       

 nlme           3.1-141   2019-08-01 [3] CRAN (R 3.6.0)                       

 nloptr         1.2.1     2018-10-03 [2] CRAN (R 3.6.0)                       

 pander         0.6.3     2018-11-06 [2] CRAN (R 3.6.0)                       

 pillar         1.4.2     2019-06-29 [2] CRAN (R 3.6.0)                       

 pkgbuild       1.0.5     2019-08-26 [2] CRAN (R 3.6.0)                       

 pkgconfig      2.0.3     2019-09-22 [2] CRAN (R 3.6.0)                        

 pkgload        1.0.2     2018-10-29 [2] CRAN (R 3.5.2)                       

 plyr           1.8.4     2016-06-08 [2] CRAN (R 3.5.2)                       

 prettyunits    1.0.2     2015-07-13 [2] CRAN (R 3.5.2)                        

 processx       3.4.1     2019-07-18 [2] CRAN (R 3.6.0)                       

 proto        * 1.0.0     2016-10-29 [2] CRAN (R 3.5.2)                       

 pryr           0.1.4     2018-02-18 [2] CRAN (R 3.6.0)                       

 ps             1.3.0     2018-12-21 [2] CRAN (R 3.5.2)                       

 purrr        * 0.3.2     2019-03-15 [2] CRAN (R 3.6.0)                       

 R6             2.4.0     2019-02-14 [2] CRAN (R 3.5.2)                       

 rapportools    1.0       2014-01-07 [2] CRAN (R 3.6.0)                       

 Rcpp           1.0.2     2019-07-25 [2] CRAN (R 3.6.0)                       

 RCurl          1.95-4.12 2019-03-04 [2] CRAN (R 3.6.0)                       

 readr        * 1.3.1     2018-12-21 [2] CRAN (R 3.6.0)                       

 readxl         1.3.1     2019-03-13 [2] CRAN (R 3.6.0)                       

 remotes        2.1.0     2019-06-24 [2] CRAN (R 3.6.0)                       

 rlang          0.4.0     2019-06-25 [2] CRAN (R 3.6.0)                        

 rprojroot      1.3-2     2018-01-03 [2] CRAN (R 3.5.2)                       

 RSQLite      * 2.1.2     2019-07-24 [2] CRAN (R 3.6.0)                       

 rstudioapi     0.10      2019-03-19 [2] CRAN (R 3.5.2)                        

 rvest          0.3.4     2019-05-15 [2] CRAN (R 3.6.0)                       

 scales         1.0.0     2018-08-09 [2] CRAN (R 3.5.2)                       

 sessioninfo    1.1.1     2018-11-05 [2] CRAN (R 3.5.2)                       

 sp             1.3-1     2018-06-05 [2] CRAN (R 3.6.0)                       

 sqldf        * 0.4-11    2017-06-28 [1] CRAN (R 3.6.0)                       

 stringi        1.4.3     2019-03-12 [2] CRAN (R 3.5.2)                       

 stringr      * 1.4.0     2019-02-10 [2] CRAN (R 3.6.0)                       

 summarytools * 0.9.5     2019-12-16 [1] Github (dcomtois/summarytools@01394c8)

testthat       2.2.1     2019-07-25 [2] CRAN (R 3.6.0)                       

 tibble       * 2.1.3     2019-06-06 [2] CRAN (R 3.6.0)                       

 tidyr        * 1.0.0     2019-09-11 [2] CRAN (R 3.6.0)                       

 tidyselect     0.2.5     2018-10-11 [2] CRAN (R 3.5.2)                       

 tidyverse    * 1.2.1     2017-11-14 [1] CRAN (R 3.6.0)                        

 usethis      * 1.5.1     2019-07-04 [2] CRAN (R 3.6.0)                       

 utf8           1.1.4     2018-05-24 [2] CRAN (R 3.5.2)                       

 vcd            1.4-4     2017-12-06 [1] CRAN (R 3.6.0)                       

 vctrs          0.2.0     2019-07-05 [2] CRAN (R 3.6.0)                       

 withr          2.1.2     2018-03-15 [2] CRAN (R 3.5.2)                       

 xml2           1.2.2     2019-08-09 [2] CRAN (R 3.6.0)                       

 yaml           2.2.0     2018-07-25 [2] CRAN (R 3.5.2)                       

 zeallot        0.1.0     2018-01-28 [2] CRAN (R 3.5.2)                       

 zoo            1.8-6     2019-05-28 [2] CRAN (R 3.6.0)  
dcomtois commented 4 years ago

Can you pls try this:

# Remove existing summarytools
remove.packages("summarytools")

# Install from github -- pander and summarytools dev-current
install.packages("remotes")
library(remotes)
install_github("rapporter/pander")
install_github("dcomtois/summarytools", ref = "dev-current")

# Load package and change use.x11 option
library(summarytools)
st_options(use.x11 = FALSE)

dfSummary(mtcars)

Hopefully this resolves the issue.

What comes next won't be relevant to you if you work on a terminal-only system, but I put it here for RH - Gnome users (and for myself) as a reference.

Installing R and summarytools on Red Hat 8

From a CRAN mirror > Download R for Linux > Follow instructions from the README file in /bin/linux/redhad

Then...

subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
sudo yum install R
sudo yum install ImageMagick-c++-devel
sudo yum install curl-devel

And finally...

install.packages("RCurl")
install.packages("summarytools")
jrisi256 commented 4 years ago

Unfortunately this was not working on RedHat 7, but in the coming weeks I will update to RedHat 8 to see if it works for me then.

dcomtois commented 4 years ago

Sorry to hear that, hopefully it does work in RH version 8... Keep us posted!

jrisi256 commented 4 years ago

Hi! Sorry for the long delay, Hope you're safe and healthy during corona-virus times.

So I tried the suggested code code chunk in your above comment (dev_tools::install_github() and using st_options(x11 = F) however it is still not working. It still displays ASCII art.

Below is a warning message which is displayed when library(summarytools) is called.

Registered S3 method overwritten by 'pryr':
  method      from
  print.bytes Rcpp
system might not have X11 capabilities; in case of errors when using dfSummary(), set st_options(use.x11 = FALSE)
Warning message:
In fun(libname, pkgname) : couldn't connect to display ":0"

And below is session info

 ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

setting  value                              
version  R version 3.6.3 (2020-02-29)       
os       Red Hat Enterprise Linux 8.1 (Ootpa)
system   x86_64, linux-gnu                  
ui       RStudio                            
language (EN)                               
collate  en_US.UTF-8                        
ctype    en_US.UTF-8                        
tz       America/New_York                   
date     2020-03-23                         

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package      * version date       lib source                               
assertthat     0.2.1   2019-03-21 [2] CRAN (R 3.6.3)                       
backports      1.1.5   2019-10-02 [2] CRAN (R 3.6.3)                        
base64enc      0.1-3   2015-07-28 [2] CRAN (R 3.6.3)                       
callr          3.4.2   2020-02-12 [2] CRAN (R 3.6.3)                       
checkmate      2.0.0   2020-02-06 [2] CRAN (R 3.6.3)                       
cli            2.0.2   2020-02-28 [2] CRAN (R 3.6.3)                       
codetools      0.2-16  2018-12-24 [3] CRAN (R 3.6.3)                       
crayon         1.3.4   2017-09-16 [2] CRAN (R 3.6.3)                       
desc           1.2.0   2018-05-01 [2] CRAN (R 3.6.3)                       
devtools       2.2.2   2020-02-17 [2] CRAN (R 3.6.3)                       
digest         0.6.25  2020-02-23 [2] CRAN (R 3.6.3)                       
dplyr          0.8.4   2020-01-31 [2] CRAN (R 3.6.3)                        
ellipsis       0.3.0   2019-09-20 [2] CRAN (R 3.6.3)                       
fansi          0.4.1   2020-01-08 [2] CRAN (R 3.6.3)                       
fs             1.3.1   2019-05-06 [2] CRAN (R 3.6.3)                       
glue           1.3.1   2019-03-12 [2] CRAN (R 3.6.3)                       
htmltools      0.4.0   2019-10-04 [2] CRAN (R 3.6.3)                       
knitr          1.28    2020-02-06 [2] CRAN (R 3.6.3)                       
lifecycle      0.1.0   2019-08-01 [2] CRAN (R 3.6.3)                       
lubridate      1.7.4   2018-04-11 [2] CRAN (R 3.6.3)                       
magick         2.3     2020-01-24 [2] CRAN (R 3.6.3)                        
magrittr       1.5     2014-11-22 [2] CRAN (R 3.6.3)                       
matrixStats    0.55.0  2019-09-07 [2] CRAN (R 3.6.3)                       
memoise        1.1.0   2017-04-21 [2] CRAN (R 3.6.3)                       
pander         0.6.4   2020-03-23 [1] Github (rapporter/pander@81dd8d1)    
pillar         1.4.3   2019-12-20 [2] CRAN (R 3.6.3)                       
pkgbuild       1.0.6   2019-10-09 [2] CRAN (R 3.6.3)                       
pkgconfig      2.0.3   2019-09-22 [2] CRAN (R 3.6.3)                       
pkgload        1.0.2   2018-10-29 [2] CRAN (R 3.6.3)                       
plyr           1.8.5   2019-12-10 [2] CRAN (R 3.6.3)                       
prettyunits    1.1.1   2020-01-24 [2] CRAN (R 3.6.3)                        
processx       3.4.2   2020-02-09 [2] CRAN (R 3.6.3)                       
pryr           0.1.4   2018-02-18 [2] CRAN (R 3.6.3)                       
ps             1.3.2   2020-02-13 [2] CRAN (R 3.6.3)                       
purrr          0.3.3   2019-10-18 [2] CRAN (R 3.6.3)                       
R6             2.4.1   2019-11-12 [2] CRAN (R 3.6.3)                       
rapportools    1.0     2014-01-07 [2] CRAN (R 3.6.3)                       
Rcpp           1.0.3   2019-11-08 [2] CRAN (R 3.6.3)                       
remotes        2.1.1   2020-02-15 [2] CRAN (R 3.6.3)                       
rlang          0.4.5   2020-03-01 [2] CRAN (R 3.6.3)                       
rprojroot      1.3-2   2018-01-03 [2] CRAN (R 3.6.3)                       
rstudioapi     0.11    2020-02-07 [2] CRAN (R 3.6.3)                       
sessioninfo    1.1.1   2018-11-05 [2] CRAN (R 3.6.3)                       
stringi        1.4.6   2020-02-17 [2] CRAN (R 3.6.3)                       
stringr        1.4.0   2019-02-10 [2] CRAN (R 3.6.3)                       
summarytools * 0.9.6   2020-03-23 [1] Github (dcomtois/summarytools@9af4c0a)
testthat       2.3.2   2020-03-02 [2] CRAN (R 3.6.3)                       
tibble         2.1.3   2019-06-06 [2] CRAN (R 3.6.3)                       
tidyr          1.0.2   2020-01-24 [2] CRAN (R 3.6.3)                       
tidyselect     1.0.0   2020-01-27 [2] CRAN (R 3.6.3)                        
usethis        1.5.1   2019-07-04 [2] CRAN (R 3.6.3)                       
vctrs          0.2.3   2020-02-20 [2] CRAN (R 3.6.3)                       
withr          2.1.2   2018-03-15 [2] CRAN (R 3.6.3)                       
xfun           0.12    2020-01-13 [2] CRAN (R 3.6.3)                       

[1] /home/danbergbiggs/R/x86_64-pc-linux-gnu-library/3.6
[2] /opt/R/3.6.3/lib/R/site-library
[3] /opt/R/3.6.3/lib/R/library
dcomtois commented 4 years ago

Hello,

I'm healthy and safe, thank you. I wish you all the same :)

Just to make sure I understand clearly what's going on, could you pls post a screen shot of the results you get, as well as the results you're looking for (image or link to an online document)? Thx!

jrisi256 commented 4 years ago

Below is what I'm seeing.

image

Below is what I'd like to be able to do (section 2.4). But this may not be possible without X11 tunneling.

https://cran.r-project.org/web/packages/summarytools/vignettes/Introduction.html

dcomtois commented 4 years ago

Oh ok now I understand... I thought by "ascii art" you meant something was wrong with the text graphs. You're correct (to my knowledge) to say that without X11, it is not possible to generate graphical devices, specifically you can't generate the png's used in the html summaries.

jrisi256 commented 4 years ago

Thanks for the clarification. It may be beyond the scope of my request, but do you know of any documentation or anything which could help in setting up X11 through ssh tunnelling?

dcomtois commented 4 years ago

Sorry, I can't really point you to anything different from what Google would, as I have never tried this. Good luck and let us know if you succeed, as I'm sure other users will also run into that issue at some point. Thanks!