Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with options(readr.show_col_types = FALSE) #1250

Closed
lukeholman opened this issue Jul 28, 2021 · 3 comments
Closed

Problem with options(readr.show_col_types = FALSE) #1250

lukeholman opened this issue Jul 28, 2021 · 3 comments

Comments

@lukeholman
Copy link

Hi there,

The option options(readr.show_col_types = FALSE) does not currently work for me, as shown below. When I pass show_col_types = FALSE directly to read_csv(), it works fine. Session info below.

> library(readr)
> options(readr.show_col_types = FALSE)
> read_csv("data/my_dat.csv")
Rows: 165928 Columns: 7                                                                                                                                                               
── Column specification ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (5): Trait, Sex, Trait guild, Trait description, Reference
dbl (2): line, trait_valueUse `spec()` to retrieve the full column specification for this data.Specify the column types or set `show_col_types = FALSE` to quiet this message.
# A tibble: 165,928 x 7
  SNIPPED DATA
# … with 165,918 more rows
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] readr_2.0.0     workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6     rstudioapi_0.11  knitr_1.32       magrittr_2.0.1   hms_0.5.3        tidyselect_1.1.0 bit_1.1-15.2     R6_2.4.1        
 [9] rlang_0.4.6      fansi_0.4.1      tools_4.0.3      parallel_4.0.3   vroom_1.5.3      xfun_0.22        utf8_1.1.4       cli_2.0.2       
[17] withr_2.2.0      htmltools_0.5.0  ellipsis_0.3.1   assertthat_0.2.1 bit64_0.9-7      yaml_2.2.1       digest_0.6.25    tibble_3.0.1    
[25] lifecycle_0.2.0  crayon_1.3.4     purrr_0.3.4      later_1.0.0      tzdb_0.1.2       vctrs_0.3.0      promises_1.1.0   fs_1.4.1        
[33] glue_1.4.2       evaluate_0.14    rmarkdown_2.5    compiler_4.0.3   pillar_1.4.4     httpuv_1.5.3.1   pkgconfig_2.0.3 
@jimhester
Copy link
Collaborator

Thank you for opening the issue with a reproducible example!

This is happening because the option is actually called readr.show_types in the code 🙈

if (identical(getOption("readr.show_types", TRUE), FALSE)) {

I now think it makes more sense to name option this the same as the argument name, and that is what is in the documentation elsewhere, so this is now fixed to work how you were expecting.

library(readr)
options(readr.show_col_types = FALSE)
read_csv(readr_example("mtcars.csv"))
#> # A tibble: 32 × 11
#>      mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb
#>    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1  21       6  160    110  3.9   2.62  16.5     0     1     4     4
#>  2  21       6  160    110  3.9   2.88  17.0     0     1     4     4
#>  3  22.8     4  108     93  3.85  2.32  18.6     1     1     4     1
#>  4  21.4     6  258    110  3.08  3.22  19.4     1     0     3     1
#>  5  18.7     8  360    175  3.15  3.44  17.0     0     0     3     2
#>  6  18.1     6  225    105  2.76  3.46  20.2     1     0     3     1
#>  7  14.3     8  360    245  3.21  3.57  15.8     0     0     3     4
#>  8  24.4     4  147.    62  3.69  3.19  20       1     0     4     2
#>  9  22.8     4  141.    95  3.92  3.15  22.9     1     0     4     2
#> 10  19.2     6  168.   123  3.92  3.44  18.3     1     0     4     4
#> # … with 22 more rows

@PStaus
Copy link

PStaus commented Aug 26, 2022

Hi thank you for this hint and the wonderful package. Actually, it doesn't work for me now if I use
options(readr.show_types = FALSE). Only if I use options(readr.show_col_types = FALSE) it worked for me now.
I am using it in an R notebook, readr Version 2.1.2. R.version 4.2.1 The autocomplete function of R Studio 2022.7.1.554 only suggests the readr.show_types option.

---
title: "R Notebook"
output: html_notebook
---

```{r}
library(readr)
options(readr.show_types = FALSE)

read_csv(readr_example("mtcars.csv"))

Best wishes,

@daattali
Copy link
Contributor

daattali commented Sep 12, 2022

I can confirm that for me too options(readr.show_col_types = FALSE) and show_cols does not. Latest CRAN version 2.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants