ModernDive_book icon indicating copy to clipboard operation
ModernDive_book copied to clipboard

the skim function doesn't give statistics

Open xiaoouwang opened this issue 5 years ago • 11 comments

I don't know if it's just me but when I run

evals_ch5 <- evals %>%
  select(ID, score, bty_avg, age)
evals_ch5 %>% select(score, bty_avg) %>% skim()

the results show no statistics image

xiaoouwang avatar Dec 11 '19 22:12 xiaoouwang

Hi @xiaoouwang. The summary statistics that we show appear in the lines following the last line that you have in your screenshot:

library(moderndive)
library(tidyverse)
library(skimr) #v2.0.2

evals_ch5 <- evals %>%
  select(ID, score, bty_avg, age)
evals_ch5 %>% select(score, bty_avg) %>% skim()
── Data Summary ────────────────────────
                           Values    
Name                       Piped data
Number of rows             463       
Number of columns          2         
_______________________              
Column type frequency:               
  numeric                  2         
________________________             
Group variables            None      

── Variable type: numeric ─────────────────────────────────────────────────────────────────────────────
  skim_variable n_missing complete_rate  mean    sd    p0   p25   p50   p75  p100 hist 
1 score                 0             1  4.17 0.544  2.3   3.8   4.3    4.6  5    ▁▁▅▇▇
2 bty_avg               0             1  4.42 1.53   1.67  3.17  4.33   5.5  8.17 ▃▇▇▃▂

In the book, we are using a modified version of the output that v1.0.6 of {skimr} produces:

library(moderndive)
library(tidyverse)
# remove.packages("skimr")
# Restart R
# remotes::install_version(package = "skimr", version = "1.0.6")
library(skimr) #v1.0.6

evals_ch5 <- evals %>%
  select(ID, score, bty_avg, age)
evals_ch5 %>% select(score, bty_avg) %>% skim()
Skim summary statistics
 n obs: 463 
 n variables: 2 

── Variable type:numeric ──────────────────────────────────────────────────────────────────────────────
 variable missing complete   n mean   sd   p0  p25  p50 p75 p100     hist
  bty_avg       0      463 463 4.42 1.53 1.67 3.17 4.33 5.5 8.17 ▂▅▅▇▃▃▂▁
    score       0      463 463 4.17 0.54 2.3  3.8  4.3  4.6 5    ▁▁▂▃▅▇▇▆

Hope that helps!

ismayc avatar Dec 11 '19 23:12 ismayc

Hi @xiaoouwang. The summary statistics that we show appear in the lines following the last line that you have in your screenshot:

library(moderndive)
library(tidyverse)
library(skimr) #v2.0.2

evals_ch5 <- evals %>%
  select(ID, score, bty_avg, age)
evals_ch5 %>% select(score, bty_avg) %>% skim()
── Data Summary ────────────────────────
                           Values    
Name                       Piped data
Number of rows             463       
Number of columns          2         
_______________________              
Column type frequency:               
  numeric                  2         
________________________             
Group variables            None      

── Variable type: numeric ─────────────────────────────────────────────────────────────────────────────
  skim_variable n_missing complete_rate  mean    sd    p0   p25   p50   p75  p100 hist 
1 score                 0             1  4.17 0.544  2.3   3.8   4.3    4.6  5    ▁▁▅▇▇
2 bty_avg               0             1  4.42 1.53   1.67  3.17  4.33   5.5  8.17 ▃▇▇▃▂

In the book, we are using a modified version of the output that v1.0.6 of {skimr} produces:

library(moderndive)
library(tidyverse)
# remove.packages("skimr")
# Restart R
# remotes::install_version(package = "skimr", version = "1.0.6")
library(skimr) #v1.0.6

evals_ch5 <- evals %>%
  select(ID, score, bty_avg, age)
evals_ch5 %>% select(score, bty_avg) %>% skim()
Skim summary statistics
 n obs: 463 
 n variables: 2 

── Variable type:numeric ──────────────────────────────────────────────────────────────────────────────
 variable missing complete   n mean   sd   p0  p25  p50 p75 p100     hist
  bty_avg       0      463 463 4.42 1.53 1.67 3.17 4.33 5.5 8.17 ▂▅▅▇▃▃▂▁
    score       0      463 463 4.17 0.54 2.3  3.8  4.3  4.6 5    ▁▁▂▃▅▇▇▆

Hope that helps!

Hi ismayc I found the solution here : it's due to some problem with the new tibble datatype. Maybe it would be helpful to mention it in the book.

https://github.com/ropensci/skimr/issues/554

xiaoouwang avatar Dec 17 '19 17:12 xiaoouwang

Can you confirm that you also see this when you use version 1.0.6?

ismayc avatar Dec 17 '19 19:12 ismayc

Can you confirm that you also see this when you use version 1.0.6?

Oh i didn't test it on 1.0.6. I've installed with install.Package and it directly installs version 2.x. I think many people will install directly the most recent version too.

xiaoouwang avatar Dec 17 '19 19:12 xiaoouwang

Right, but one reason we use version 1.0.6 is problems with version 2.x and above. You can see the other versions of the packages we used at https://moderndive.com/E-appendixE.html. You can install the previous version via

remove.packages("skimr");remotes::install_version(package = "skimr", version = "1.0.6")

ismayc avatar Dec 17 '19 19:12 ismayc

@ismayc If there is an issue in skimr v2 can you let us know in our tracker? http://github.com/ropensci/skimr.

elinw avatar Dec 22 '19 07:12 elinw

Unfortunately the issues I brought up in https://github.com/ropensci/skimr/issues/424 were never cleanly resolved for what we were after. We ended up needing to copy-and-paste the modified output in the book to be able to show some of the functionality.

ismayc avatar Dec 22 '19 07:12 ismayc

So is the issue about wrapping or about being able to specify a specific length? I also have issues about bookdown and I will try to look into it.

elinw avatar Dec 24 '19 02:12 elinw

A little of both. Feel free to play around with either the Chapter 5 or Chapter 6 files so you can see the output.

ismayc avatar Dec 24 '19 02:12 ismayc

Take a look at version 2.1, it may solve the issue. There are new parameters to the print function that allow control of the horizontal rule.

elinw avatar Feb 06 '20 06:02 elinw

Thanks for the heads up @elinw, we'll re-open this issue and take a look at v2.1 when we have a moment.

rudeboybert avatar Feb 06 '20 14:02 rudeboybert