rstudio / pins-r

Pin, Discover and Share Resources
https://pins.rstudio.com
Other
301 stars 62 forks source link

pin_search docs for 'return all pins of this board' #509

Closed elfatherbrown closed 2 years ago

elfatherbrown commented 2 years ago

Hi. It took me a while to figure out that I need to pin_search(board, "") (empty string), to get all the pins of the board in a data frame. I guess maybe just updating the docs to show how to get them all? Reprex:

b <- pins::board_folder(path = '/home/alex/Dropbox/rpins/datasets/oas/multidim21/out')
#Get all pins in this board... works by default? By default?
pins::pin_search(b)
#> Error in grepl(search, out$name, fixed = TRUE): argument "search" is missing, with no default
#Is it a regex? It used to be...
pins::pin_search(b,".*")
#> # A tibble: 0 × 6
#> # … with 6 variables: name <chr>, type <chr>, title <chr>, created <dttm>,
#> #   file_size <fs::bytes>, meta <list>
#Nope
#checked the code in github... ah, grepl in pin_search is fixed=TRUE so...
pins::pin_search(b,"")
#> # A tibble: 12 × 6
#>    name                        type  title created              file_size meta  
#>    <chr>                       <chr> <chr> <dttm>              <fs::byte> <list>
#>  1 W                           rds   <NA>  2021-09-09 13:32:00    135.45K <pins…
#>  2 W imputed                   rds   <NA>  2021-09-01 13:08:00      8.97K <pins…
#>  3 W_datadict                  rds   <NA>  2021-08-24 14:13:00        725 <pins…
#>  4 W_raw_input                 rds   <NA>  2021-08-18 19:01:00     12.93K <pins…
#>  5 all_wider_raw               rds   <NA>  2021-09-08 18:44:00      1.23M <pins…
#>  6 complete_fulfilled_datadict rds   <NA>  2021-08-18 18:27:00       5.6K <pins…
#>  7 country_list_map            rds   <NA>  2021-08-23 14:46:00     15.06K <pins…
#>  8 final_dataset               rds   <NA>  2021-08-23 14:51:00     75.34K <pins…
#>  9 full_final_as_googlesheet   json  <NA>  2021-08-18 18:39:00      1.03M <pins…
#> 10 wbW                         rds   <NA>  2021-08-24 12:57:00     15.82K <pins…
#> 11 wider_companion_quality_raw rds   <NA>  2021-09-09 13:42:00      3.72M <pins…
#> 12 wider_raw                   rds   <NA>  2021-08-24 12:59:00      3.72M <pins…
#yup

Created on 2021-09-10 by the reprex package (v2.0.1)

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 3.6.3 (2020-02-29) #> os Ubuntu 20.04.3 LTS #> system x86_64, linux-gnu #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/Mazatlan #> date 2021-09-10 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> ! package * version date lib source #> P cli 3.0.1 2021-07-17 [?] CRAN (R 3.6.3) #> P crayon 1.4.1 2021-02-08 [?] CRAN (R 3.6.3) #> P digest 0.6.27 2020-10-24 [?] CRAN (R 3.6.3) #> P ellipsis 0.3.2 2021-04-29 [?] CRAN (R 3.6.3) #> P evaluate 0.14 2019-05-28 [?] CRAN (R 3.6.3) #> P fansi 0.5.0 2021-05-25 [?] CRAN (R 3.6.3) #> P fastmap 1.1.0 2021-01-25 [?] CRAN (R 3.6.3) #> P fs 1.5.0 2020-07-31 [?] CRAN (R 3.6.3) #> P glue 1.4.2 2020-08-27 [?] CRAN (R 3.6.3) #> P highr 0.9 2021-04-16 [?] CRAN (R 3.6.3) #> P htmltools 0.5.2 2021-08-25 [?] CRAN (R 3.6.3) #> P knitr 1.33 2021-04-24 [?] CRAN (R 3.6.3) #> P lifecycle 1.0.0 2021-02-15 [?] CRAN (R 3.6.3) #> P magrittr 2.0.1 2020-11-17 [?] CRAN (R 3.6.3) #> P pillar 1.6.2 2021-07-29 [?] CRAN (R 3.6.3) #> pins 0.99.9000 2021-09-10 [1] Github (rstudio/pins@b5696d1) #> P pkgconfig 2.0.3 2019-09-22 [?] CRAN (R 3.6.3) #> P rappdirs 0.3.3 2021-01-31 [?] CRAN (R 3.6.3) #> P reprex 2.0.1 2021-08-05 [?] CRAN (R 3.6.3) #> P rlang 0.4.11 2021-04-30 [?] CRAN (R 3.6.3) #> P rmarkdown 2.10 2021-08-06 [?] CRAN (R 3.6.3) #> P rstudioapi 0.13 2020-11-12 [?] CRAN (R 3.6.3) #> P sessioninfo 1.1.1 2018-11-05 [?] CRAN (R 3.6.3) #> P stringi 1.7.4 2021-08-25 [?] CRAN (R 3.6.3) #> P stringr 1.4.0 2019-02-10 [?] CRAN (R 3.6.3) #> P tibble 3.1.4 2021-08-25 [?] CRAN (R 3.6.3) #> P utf8 1.2.2 2021-07-24 [?] CRAN (R 3.6.3) #> P vctrs 0.3.8 2021-04-29 [?] CRAN (R 3.6.3) #> P withr 2.4.2 2021-04-18 [?] CRAN (R 3.6.3) #> P xfun 0.25 2021-08-06 [?] CRAN (R 3.6.3) #> P yaml 2.2.1 2020-02-01 [?] CRAN (R 3.6.3) #> #> [1] /home/alex/Devel-nosync/OAS-projects/atlas21/OasW/renv/library/R-3.6/x86_64-pc-linux-gnu #> [2] /tmp/RtmpNwx43g/renv-system-library #> [3] /usr/lib/R/library #> #> P ── Loaded and on-disk path mismatch. ```
hadley commented 2 years ago

You should use pin_list() if you want a list of all pins. This seems reasonably easy to discover from the function reference: https://pins.rstudio.com/dev/reference/index.html#section-pins. What am I missing?

elfatherbrown commented 2 years ago

I guess its just my use case which im assuming is not infrequent. I have many pins in three boards so its very helpful to get a tibble of all pins in a board in one go. That can be done by pin_search(board, ""), but its not documented as such.

I am aware of pin_list, of course, but that gives me a character vector of many names, but i became addicted to that pins tibble. I can quickly see the last created pin, for example, which is helpful for me.

hadley commented 2 years ago

Oh you want the data frame of all the metadata.

elfatherbrown commented 2 years ago

Yeah. And pin_search(b,"") gets it fine. Its just not documented and it took me a while to figure out. It is pretty useful.

github-actions[bot] commented 1 year ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.