Coder Social home page Coder Social logo

Comments (2)

dcomtois avatar dcomtois commented on July 23, 2024

Please check that you have version 0.8.1. There was an issue with 0.8.0, that might be it.

If you have 0.8.1, please paste the call to dfSummary, with a brief description of your data. Thx

from summarytools.

onesandzeroes avatar onesandzeroes commented on July 23, 2024

I am also having this issue, in summarytools version 0.8.5. In my case, the issue seems to be that I am piping a dataframe through to dfSummary, and because of that the data_info$Dataframe attribute is NULL and doesn't get added to the title. The issue doesn't occur when not using a pipe, as shown in the reprex below.

I think this can be addressed by updating the if ("Dataframe" %in% names(data_info)) check in the print method to check for NULL, I'll send a PR through shortly.

Reprex:

library(tidyverse)
library(summarytools)

data("iris")

summ1 = dfSummary(iris)
data_info1 = attr(summ1, "data_info")
data_info1
#> $Dataframe
#> [1] "iris"
#> 
#> $N.obs
#> [1] 150
print(summ1)
#> Data Frame Summary   
#> iris     
#> N: 150   
#> ------------------------------------------------------------------------------------------------------------------------
#> No   Variable        Stats / Values             Freqs (% of Valid)   Text Graph                       Valid    Missing  
#> ---- --------------- -------------------------- -------------------- -------------------------------- -------- ---------
#> 1    Sepal.Length    mean (sd) : 5.84 (0.83)    35 distinct val.       . . : :                        150      0        
#>      [numeric]       min < med < max :                                 : : : :                        (100%)   (0%)     
#>                      4.3 < 5.8 < 7.9                                   : : : : :                                        
#>                      IQR (CV) : 1.3 (0.14)                             : : : : :                                        
#>                                                                      : : : : : : : :                                    
#> 
#> 2    Sepal.Width     mean (sd) : 3.06 (0.44)    23 distinct val.             :                        150      0        
#>      [numeric]       min < med < max :                                       :                        (100%)   (0%)     
#>                      2 < 3 < 4.4                                           . :                                          
#>                      IQR (CV) : 0.5 (0.14)                               : : : :                                        
#>                                                                      . . : : : : : :                                    
#> 
#> 3    Petal.Length    mean (sd) : 3.76 (1.77)    43 distinct val.     :                                150      0        
#>      [numeric]       min < med < max :                               :         . :                    (100%)   (0%)     
#>                      1 < 4.35 < 6.9                                  :         : : .                                    
#>                      IQR (CV) : 3.5 (0.47)                           : :       : : : .                                  
#>                                                                      : :   . : : : : : .                                
#> 
#> 4    Petal.Width     mean (sd) : 1.2 (0.76)     22 distinct val.     :                                150      0        
#>      [numeric]       min < med < max :                               :                                (100%)   (0%)     
#>                      0.1 < 1.3 < 2.5                                 :       . .   :                                    
#>                      IQR (CV) : 1.5 (0.64)                           :       : :   :   .                                
#>                                                                      : :   : : : . : : :                                
#> 
#> 5    Species         1. setosa                  50 (33.3%)           IIIIIIIIIIIIIIII                 150      0        
#>      [factor]        2. versicolor              50 (33.3%)           IIIIIIIIIIIIIIII                 (100%)   (0%)     
#>                      3. virginica               50 (33.3%)           IIIIIIIIIIIIIIII                                   
#> ------------------------------------------------------------------------------------------------------------------------

summ2 = iris %>%
    select(- Petal.Length) %>%
    dfSummary()
data_info2 = attr(summ2, "data_info")
data_info2
#> $Dataframe
#> NULL
#> 
#> $N.obs
#> [1] 150
print(summ2)
#> Error in sect_title[[2]]: subscript out of bounds

from summarytools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.