tests/testthat/_snaps/output.md

output from print_cross matches expected output

Code
  ds_cross_table(mt, cyl, vs)
Output
      Cell Contents
   |---------------|
   |     Frequency |
   |       Percent |
   |       Row Pct |
   |       Col Pct |
   |---------------|

   Total Observations:  32

  -------------------------------------------------------------
  |              |                     vs                     |
  -------------------------------------------------------------
  |          cyl |            0 |            1 |    Row Total |
  -------------------------------------------------------------
  |            4 |            1 |           10 |           11 |
  |              |        0.031 |        0.312 |              |
  |              |         0.09 |         0.91 |         0.34 |
  |              |         0.06 |         0.71 |              |
  -------------------------------------------------------------
  |            6 |            3 |            4 |            7 |
  |              |        0.094 |        0.125 |              |
  |              |         0.43 |         0.57 |         0.22 |
  |              |         0.17 |         0.29 |              |
  -------------------------------------------------------------
  |            8 |           14 |            0 |           14 |
  |              |        0.438 |            0 |              |
  |              |            1 |            0 |         0.44 |
  |              |         0.78 |            0 |              |
  -------------------------------------------------------------
  | Column Total |           18 |           14 |           32 |
  |              |        0.563 |        0.437 |              |
  -------------------------------------------------------------

output from print_screener matches expected output

Code
  ds_screener(mt)
Output
  -----------------------------------------------------------------------
  |  Column Name  |  Data Type  |  Levels   |  Missing  |  Missing (%)  |
  -----------------------------------------------------------------------
  |      mpg      |   numeric   |    NA     |     0     |       0       |
  |      cyl      |   factor    |   4 6 8   |     0     |       0       |
  |     disp      |   numeric   |    NA     |     0     |       0       |
  |      hp       |   numeric   |    NA     |     0     |       0       |
  |     drat      |   numeric   |    NA     |     0     |       0       |
  |      wt       |   numeric   |    NA     |     0     |       0       |
  |     qsec      |   numeric   |    NA     |     0     |       0       |
  |      vs       |   factor    |    0 1    |     0     |       0       |
  |      am       |   factor    |    0 1    |     0     |       0       |
  |     gear      |   factor    |   3 4 5   |     0     |       0       |
  |     carb      |   factor    |1 2 3 4 6 8|     0     |       0       |
  -----------------------------------------------------------------------

   Overall Missing Values           0 
   Percentage of Missing Values     0 %
   Rows with Missing Values         0 
   Columns With Missing Values      0

output from print_fcont matches the expected result

Code
  ds_freq_table(mtcars, mpg)
Output
                                Variable: mpg                               
  |-----------------------------------------------------------------------|
  |    Bins     | Frequency | Cum Frequency |   Percent    | Cum Percent  |
  |-----------------------------------------------------------------------|
  | 10.4 - 15.1 |     6     |       6       |    18.75     |    18.75     |
  |-----------------------------------------------------------------------|
  | 15.1 - 19.8 |    12     |      18       |     37.5     |    56.25     |
  |-----------------------------------------------------------------------|
  | 19.8 - 24.5 |     8     |      26       |      25      |    81.25     |
  |-----------------------------------------------------------------------|
  | 24.5 - 29.2 |     2     |      28       |     6.25     |     87.5     |
  |-----------------------------------------------------------------------|
  | 29.2 - 33.9 |     4     |      32       |     12.5     |     100      |
  |-----------------------------------------------------------------------|
  |    Total    |    32     |       -       |    100.00    |      -       |
  |-----------------------------------------------------------------------|

output from print_fcont is as expected when data has missing values

Code
  ds_freq_table(mtcars, mpg)
Output
                                Variable: mpg                               
  |-----------------------------------------------------------------------|
  |    Bins     | Frequency | Cum Frequency |   Percent    | Cum Percent  |
  |-----------------------------------------------------------------------|
  | 10.4 - 15.1 |     6     |       6       |    18.75     |    18.75     |
  |-----------------------------------------------------------------------|
  | 15.1 - 19.8 |    12     |      18       |     37.5     |    56.25     |
  |-----------------------------------------------------------------------|
  | 19.8 - 24.5 |     8     |      26       |      25      |    81.25     |
  |-----------------------------------------------------------------------|
  | 24.5 - 29.2 |     2     |      28       |     6.25     |     87.5     |
  |-----------------------------------------------------------------------|
  | 29.2 - 33.9 |     4     |      32       |     12.5     |     100      |
  |-----------------------------------------------------------------------|
  |    Total    |    32     |       -       |    100.00    |      -       |
  |-----------------------------------------------------------------------|

output from freq_table matches the expected result

Code
  ds_freq_table(mt, cyl)
Output
                               Variable: cyl                              
  -----------------------------------------------------------------------
  Levels     Frequency    Cum Frequency       Percent        Cum Percent  
  -----------------------------------------------------------------------
     4          11             11              34.38            34.38    
  -----------------------------------------------------------------------
     6           7             18              21.88            56.25    
  -----------------------------------------------------------------------
     8          14             32              43.75             100     
  -----------------------------------------------------------------------
   Total        32              -             100.00              -      
  -----------------------------------------------------------------------

output from freq_table is as expected when data has missing values

Code
  ds_freq_table(mt, cyl)
Output
                               Variable: cyl                              
  -----------------------------------------------------------------------
  Levels     Frequency    Cum Frequency       Percent        Cum Percent  
  -----------------------------------------------------------------------
     4           9              9              32.14            32.14    
  -----------------------------------------------------------------------
     6           6             15              21.43            53.57    
  -----------------------------------------------------------------------
     8          13             28              46.43             100     
  -----------------------------------------------------------------------
  Missing        4              -                    -      
  -----------------------------------------------------------------------
   Total        32              -             100.00              -      
  -----------------------------------------------------------------------

output from group_summary matches the expected result

Code
  ds_group_summary(mt, cyl, mpg)
Output
                                             by                                             
  -----------------------------------------------------------------------------------------
  |     Statistic/Levels|                    4|                    6|                    8|
  -----------------------------------------------------------------------------------------
  |                  Obs|                   11|                    7|                   14|
  |              Minimum|                 21.4|                 17.8|                 10.4|
  |              Maximum|                 33.9|                 21.4|                 19.2|
  |                 Mean|                26.66|                19.74|                 15.1|
  |               Median|                   26|                 19.7|                 15.2|
  |                 Mode|                 22.8|                   21|                 10.4|
  |       Std. Deviation|                 4.51|                 1.45|                 2.56|
  |             Variance|                20.34|                 2.11|                 6.55|
  |             Skewness|                 0.35|                -0.26|                -0.46|
  |             Kurtosis|                -1.43|                -1.83|                 0.33|
  |       Uncorrected SS|              8023.83|              2741.14|              3277.34|
  |         Corrected SS|               203.39|                12.68|                 85.2|
  |      Coeff Variation|                16.91|                 7.36|                16.95|
  |      Std. Error Mean|                 1.36|                 0.55|                 0.68|
  |                Range|                 12.5|                  3.6|                  8.8|
  |  Interquartile Range|                  7.6|                 2.35|                 1.85|
  -----------------------------------------------------------------------------------------

output from print_ftable2 matches the expected result

Code
  ds_auto_freq_table(mt)
Condition
  Warning:
  Using an external vector in selections was deprecated in tidyselect 1.1.0.
  i Please use `all_of()` or `any_of()` instead.
    # Was:
    data %>% select(name)

    # Now:
    data %>% select(all_of(name))

  See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
Output
                               Variable: cyl                              
  -----------------------------------------------------------------------
  Levels     Frequency    Cum Frequency       Percent        Cum Percent  
  -----------------------------------------------------------------------
     4          11             11              34.38            34.38    
  -----------------------------------------------------------------------
     6           7             18              21.88            56.25    
  -----------------------------------------------------------------------
     8          14             32              43.75             100     
  -----------------------------------------------------------------------
   Total        32              -             100.00              -      
  -----------------------------------------------------------------------

Condition
  Warning:
  Using an external vector in selections was deprecated in tidyselect 1.1.0.
  i Please use `all_of()` or `any_of()` instead.
    # Was:
    data %>% select(name)

    # Now:
    data %>% select(all_of(name))

  See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
Output
                               Variable: vs                               
  -----------------------------------------------------------------------
  Levels     Frequency    Cum Frequency       Percent        Cum Percent  
  -----------------------------------------------------------------------
     0          18             18              56.25            56.25    
  -----------------------------------------------------------------------
     1          14             32              43.75             100     
  -----------------------------------------------------------------------
   Total        32              -             100.00              -      
  -----------------------------------------------------------------------

Condition
  Warning:
  Using an external vector in selections was deprecated in tidyselect 1.1.0.
  i Please use `all_of()` or `any_of()` instead.
    # Was:
    data %>% select(name)

    # Now:
    data %>% select(all_of(name))

  See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
Output
                               Variable: am                               
  -----------------------------------------------------------------------
  Levels     Frequency    Cum Frequency       Percent        Cum Percent  
  -----------------------------------------------------------------------
     0          19             19              59.38            59.38    
  -----------------------------------------------------------------------
     1          13             32              40.62             100     
  -----------------------------------------------------------------------
   Total        32              -             100.00              -      
  -----------------------------------------------------------------------

Condition
  Warning:
  Using an external vector in selections was deprecated in tidyselect 1.1.0.
  i Please use `all_of()` or `any_of()` instead.
    # Was:
    data %>% select(name)

    # Now:
    data %>% select(all_of(name))

  See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
Output
                              Variable: gear                              
  -----------------------------------------------------------------------
  Levels     Frequency    Cum Frequency       Percent        Cum Percent  
  -----------------------------------------------------------------------
     3          15             15              46.88            46.88    
  -----------------------------------------------------------------------
     4          12             27              37.5             84.38    
  -----------------------------------------------------------------------
     5           5             32              15.62             100     
  -----------------------------------------------------------------------
   Total        32              -             100.00              -      
  -----------------------------------------------------------------------

Condition
  Warning:
  Using an external vector in selections was deprecated in tidyselect 1.1.0.
  i Please use `all_of()` or `any_of()` instead.
    # Was:
    data %>% select(name)

    # Now:
    data %>% select(all_of(name))

  See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
Output
                              Variable: carb                              
  -----------------------------------------------------------------------
  Levels     Frequency    Cum Frequency       Percent        Cum Percent  
  -----------------------------------------------------------------------
     1           7              7              21.88            21.88    
  -----------------------------------------------------------------------
     2          10             17              31.25            53.12    
  -----------------------------------------------------------------------
     3           3             20              9.38             62.5     
  -----------------------------------------------------------------------
     4          10             30              31.25            93.75    
  -----------------------------------------------------------------------
     6           1             31              3.12             96.88    
  -----------------------------------------------------------------------
     8           1             32              3.12              100     
  -----------------------------------------------------------------------
   Total        32              -             100.00              -      
  -----------------------------------------------------------------------

output from ds_auto_freq_table() is as expected when data has missing values

Code
  ds_auto_freq_table(fdata)
Condition
  Warning:
  Using an external vector in selections was deprecated in tidyselect 1.1.0.
  i Please use `all_of()` or `any_of()` instead.
    # Was:
    data %>% select(name)

    # Now:
    data %>% select(all_of(name))

  See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
Output
                               Variable: cyl                              
  -----------------------------------------------------------------------
  Levels     Frequency    Cum Frequency       Percent        Cum Percent  
  -----------------------------------------------------------------------
     4           9              9              32.14            32.14    
  -----------------------------------------------------------------------
     6           6             15              21.43            53.57    
  -----------------------------------------------------------------------
     8          13             28              46.43             100     
  -----------------------------------------------------------------------
  Missing        4              -              12.50              -      
  -----------------------------------------------------------------------
   Total        32              -             100.00              -      
  -----------------------------------------------------------------------

Condition
  Warning:
  Using an external vector in selections was deprecated in tidyselect 1.1.0.
  i Please use `all_of()` or `any_of()` instead.
    # Was:
    data %>% select(name)

    # Now:
    data %>% select(all_of(name))

  See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
Output
                              Variable: gear                              
  -----------------------------------------------------------------------
  Levels     Frequency    Cum Frequency       Percent        Cum Percent  
  -----------------------------------------------------------------------
     3          13             13              46.43            46.43    
  -----------------------------------------------------------------------
     4          10             23              35.71            82.14    
  -----------------------------------------------------------------------
     5           5             28              17.86             100     
  -----------------------------------------------------------------------
  Missing        4              -              12.50              -      
  -----------------------------------------------------------------------
   Total        32              -             100.00              -      
  -----------------------------------------------------------------------

output from print_cross2 matches the expected result

Code
  ds_auto_cross_table(mt)
Output
      Cell Contents
   |---------------|
   |     Frequency |
   |       Percent |
   |       Row Pct |
   |       Col Pct |
   |---------------|

   Total Observations:  32

                           cyl vs vs                           
  -------------------------------------------------------------
  |              |                     vs                     |
  -------------------------------------------------------------
  |          cyl |            0 |            1 |    Row Total |
  -------------------------------------------------------------
  |            4 |            1 |           10 |           11 |
  |              |        0.031 |        0.312 |              |
  |              |         0.09 |         0.91 |         0.34 |
  |              |         0.06 |         0.71 |              |
  -------------------------------------------------------------
  |            6 |            3 |            4 |            7 |
  |              |        0.094 |        0.125 |              |
  |              |         0.43 |         0.57 |         0.22 |
  |              |         0.17 |         0.29 |              |
  -------------------------------------------------------------
  |            8 |           14 |            0 |           14 |
  |              |        0.438 |            0 |              |
  |              |            1 |            0 |         0.44 |
  |              |         0.78 |            0 |              |
  -------------------------------------------------------------
  | Column Total |           18 |           14 |           32 |
  |              |        0.563 |        0.437 |              |
  -------------------------------------------------------------


                           cyl vs am                           
  -------------------------------------------------------------
  |              |                     am                     |
  -------------------------------------------------------------
  |          cyl |            0 |            1 |    Row Total |
  -------------------------------------------------------------
  |            4 |            3 |            8 |           11 |
  |              |        0.094 |         0.25 |              |
  |              |         0.27 |         0.73 |         0.34 |
  |              |         0.16 |         0.62 |              |
  -------------------------------------------------------------
  |            6 |            4 |            3 |            7 |
  |              |        0.125 |        0.094 |              |
  |              |         0.57 |         0.43 |         0.22 |
  |              |         0.21 |         0.23 |              |
  -------------------------------------------------------------
  |            8 |           12 |            2 |           14 |
  |              |        0.375 |        0.062 |              |
  |              |         0.86 |         0.14 |         0.44 |
  |              |         0.63 |         0.15 |              |
  -------------------------------------------------------------
  | Column Total |           19 |           13 |           32 |
  |              |        0.594 |        0.406 |              |
  -------------------------------------------------------------


                            vs vs am                           
  -------------------------------------------------------------
  |              |                     am                     |
  -------------------------------------------------------------
  |           vs |            0 |            1 |    Row Total |
  -------------------------------------------------------------
  |            0 |           12 |            6 |           18 |
  |              |        0.375 |        0.188 |              |
  |              |         0.67 |         0.33 |         0.56 |
  |              |         0.63 |         0.46 |              |
  -------------------------------------------------------------
  |            1 |            7 |            7 |           14 |
  |              |        0.219 |        0.219 |              |
  |              |          0.5 |          0.5 |         0.44 |
  |              |         0.37 |         0.54 |              |
  -------------------------------------------------------------
  | Column Total |           19 |           13 |           32 |
  |              |        0.594 |        0.407 |              |
  -------------------------------------------------------------


Try the descriptr package in your browser

Any scripts or data that you put into this service are public.

descriptr documentation built on April 3, 2025, 8:46 p.m.