From 0c9a0686ec23c361e7c7ea22846dea07a7b506c6 Mon Sep 17 00:00:00 2001
From: juliasilge A function to store factors Instead, we can also write a special function for reading, to
reconstruct the factor including its levels: Reading from the downloaded pin is straightforward;
As before, you can pipe the result of pins 1.0.0 clearly separates the two cases of pin an object and
pinning a file, so here instead of This now needs to be made explicit with the new
The first argument is the object to save (usually a data frame, but
it can be any R object), and the second argument gives the “name” of the
@@ -225,14 +225,14 @@ This shows you the metadata that’s generated by default. This
includes: While we’ll do our best to keep the automatically generated metadata
consistent over time, I’d recommend manually capturing anything you
really care about in You can list all the available versions with
You can delete a specific older version with
ten_letters <- factor(sample(letters, size = 10), levels = letters)
board %>% pin_write_factor_json(ten_letters, "letters-as-json")
-#> Creating new version '20230905T191726Z-d3c26'
+#> Creating new version '20230908T201545Z-c5601'
#> Writing to pin 'letters-as-json'
A function to read factors
@@ -170,7 +170,7 @@
A function to read factors
+#> [1] "q" "t" "v" "h" "k" "w" "a" "o" "u" "p"
@@ -181,7 +181,7 @@
A function to read factors}
board %>% pin_read_factor_json("letters-as-json")
-#> [1] a l h m c v d b x p
+#> [1] q t v h k w a o u p
#> Levels: a b c d e f g h i j k l m n o p q r s t u v w x y z
Upload a single filearrow::write_feather(mtcars, path, compression = "uncompressed")
pin_upload(board, paths = path, name = pin_name)
-#> Creating new version '20230905T191730Z-be312'
pin_download()
returns a local path that can be piped to
arrow::read_feather()
:Function to manage uploadingpin_write():
pin_upload_arrow(board, x = mtcars, name = "mtcars-arrow2")
-#> Creating new version '20230905T191730Z-be312'
pin_download()
to
your reader function:
diff --git a/dev/articles/pins-update.html b/dev/articles/pins-update.html
index fbce4b38..fbc5e9c5 100644
--- a/dev/articles/pins-update.html
+++ b/dev/articles/pins-update.html
@@ -148,7 +148,7 @@
Examples
pin_write(board, head(mtcars), "mtcars")
#> Guessing `type = 'rds'`
-#> Creating new version '20230905T191735Z-8df40'
+#> Creating new version '20230908T201553Z-8df40'
#> Writing to pin 'mtcars'
pin_read(board, "mtcars")
#> mpg cyl disp hp drat wt qsec vs am gear carb
@@ -187,7 +187,7 @@
Pinning filespin(path, "alphabet", board = "vignette")
pin_get("alphabet", board = "vignette")
-#> [1] "/tmp/Rtmp6ZdTOF/file20a46cefb637/alphabet/file20a437fabd74"
pin_write()
and
pin_read()
you need to pin_upload()
and
@@ -195,9 +195,9 @@ Pinning files
+#> [1] "~/.local/share/pins/alphabet/20230908T201554Z-ee580/file20797f81ffde"
# Modern API
board %>% pin_upload(path, "alphabet")
-#> Creating new version '20230905T191737Z-ee580'
+#> Creating new version '20230908T201554Z-ee580'
board %>% pin_download("alphabet")
-#> [1] "~/.local/share/pins/alphabet/20230905T191737Z-ee580/file20a437fabd74"
Pinning a url
@@ -209,7 +209,7 @@
Pinning a urlbase <- "https://raw.githubusercontent.com/rstudio/pins-r/main/tests/testthat/"
(pin(paste0(base, "pin-files/first.txt"), board = "vignette"))
-#> [1] "/tmp/Rtmp6ZdTOF/file20a46cefb637/first/first.txt"
board_url()
, and since this returns a path, not a file, you
need to use pin_download()
:Implicit board
board %>% pin_write(data.frame(x = 1:3), "test-data")
#> Guessing `type = 'rds'`
-#> Creating new version '20230905T191738Z-59306'
+#> Creating new version '20230908T201555Z-59306'
#> Writing to pin 'test-data'
board %>% pin_read("test-data")
#> x
diff --git a/dev/articles/pins.html b/dev/articles/pins.html
index fbc62b03..265e7b2e 100644
--- a/dev/articles/pins.html
+++ b/dev/articles/pins.html
@@ -142,7 +142,7 @@
Reading and writing datamtcars <- tibble::as_tibble(mtcars)
board %>% pin_write(mtcars, "mtcars")
#> Guessing `type = 'rds'`
-#> Creating new version '20230905T191741Z-66c17'
+#> Creating new version '20230908T201557Z-66c17'
#> Writing to pin 'mtcars'
Metadata#> $ title : chr "mtcars: a pinned 32 x 11 data frame"
#> $ description: NULL
#> $ tags : NULL
-#> $ created : POSIXct[1:1], format: "2023-09-05 19:17:41"
+#> $ created : POSIXct[1:1], format: "2023-09-08 20:15:57"
#> $ api_version: int 1
#> $ user : list()
#> $ name : chr "mtcars"
#> $ local :List of 3
-#> ..$ dir : 'fs_path' chr "/tmp/RtmpdAcHun/pins-20ed45b7a07a/mtcars/20230905T191741Z-66c17"
+#> ..$ dir : 'fs_path' chr "/tmp/RtmpAY1xlh/pins-20c3715fcc03/mtcars/20230908T201557Z-66c17"
#> ..$ url : NULL
-#> ..$ version: chr "20230905T191741Z-66c17"
+#> ..$ version: chr "20230908T201557Z-66c17"
@@ -269,14 +269,14 @@
Metadata#> $ title : chr "mtcars: a pinned 32 x 11 data frame"
#> $ description: NULL
#> $ tags : NULL
-#> $ created : POSIXct[1:1], format: "2023-09-05 19:17:41"
+#> $ created : POSIXct[1:1], format: "2023-09-08 20:15:57"
#> $ api_version: int 1
#> $ user : list()
#> $ name : chr "mtcars"
#> $ local :List of 3
-#> ..$ dir : 'fs_path' chr "/tmp/RtmpdAcHun/pins-20ed45b7a07a/mtcars/20230905T191741Z-66c17"
+#> ..$ dir : 'fs_path' chr "/tmp/RtmpAY1xlh/pins-20c3715fcc03/mtcars/20230908T201557Z-66c17"
#> ..$ url : NULL
-#> ..$ version: chr "20230905T191741Z-66c17"
+#> ..$ version: chr "20230908T201557Z-66c17"
metadata
.Versioningboard2 <- board_temp(versioned = TRUE)
board2 %>% pin_write(1:5, name = "x", type = "rds")
-#> Creating new version '20230905T191743Z-d5d32'
+#> Creating new version '20230908T201559Z-d5d32'
#> Writing to pin 'x'
board2 %>% pin_write(2:6, name = "x", type = "rds")
-#> Creating new version '20230905T191743Z-0f6c4'
+#> Creating new version '20230908T201559Z-0f6c4'
#> Writing to pin 'x'
board2 %>% pin_write(3:7, name = "x", type = "rds")
-#> Creating new version '20230905T191743Z-9139f'
+#> Creating new version '20230908T201559Z-9139f'
#> Writing to pin 'x'
pin_versions()
:Versioning#> # A tibble: 3 × 3
#> version created hash
#> <chr> <dttm> <chr>
-#> 1 20230905T191743Z-0f6c4 2023-09-05 19:17:43 0f6c4
-#> 2 20230905T191743Z-9139f 2023-09-05 19:17:43 9139f
-#> 3 20230905T191743Z-d5d32 2023-09-05 19:17:43 d5d32
+#> 1 20230908T201559Z-0f6c4 2023-09-08 20:15:59 0f6c4
+#> 2 20230908T201559Z-9139f 2023-09-08 20:15:59 9139f
+#> 3 20230908T201559Z-d5d32 2023-09-08 20:15:59 d5d32
pin_version_delete()
or sets of older versions with
pin_versions_prune()
.Reading and writing filesNow I can upload those to the board:
board %>% pin_upload(paths, "example")
-#> Creating new version '20230905T191743Z-e9d42'
pin_download()
returns a vector of paths:
board %>% pin_download("example")
-#> [1] "/tmp/RtmpdAcHun/pins-20ed45b7a07a/example/20230905T191743Z-e9d42/mtcars.csv"
-#> [2] "/tmp/RtmpdAcHun/pins-20ed45b7a07a/example/20230905T191743Z-e9d42/alphabet.txt"
It’s now your job to handle them. You should treat these paths as internal implementation details — never modify them and never save them for use outside of pins.
@@ -380,7 +380,7 @@
board %>% pin_download("mtcars")
-#> [1] "/tmp/RtmpdAcHun/pins-20ed45b7a07a/mtcars/20230905T191741Z-66c17/mtcars.rds"
board %>% pin_write(mtcars, type = "json")
#> Using `name = 'mtcars'`
-#> Creating new version '20230905T191755Z-c2702'
+#> Creating new version '20230908T201609Z-c2702'
#> Writing to pin 'mtcars'
Let’s make a new version of this data by adding a column:
lper100km
, consumption in liters per 100 km. This could
@@ -161,7 +161,7 @@
Let’s check our board to ensure we have one pin named
"mtcars"
, with two versions:
Because a board_url()
is consumed over the web, it
doesn’t have access to a file system the way, for example, a
board_folder()
has; we can work around this by creating a
@@ -199,8 +199,8 @@
mtcars:
-- mtcars/20230905T191755Z-c2702/
-- mtcars/20230905T191757Z-8416c/
+- mtcars/20230908T201609Z-c2702/
+- mtcars/20230908T201611Z-8416c/
At this point, we would publish the folder containing the board as a
part of a web site. Let’s pretend that we have served the folder from
our fake website, https://not.real.website.co/pins/
.
We can read the most-recent version of the "mtcars"
pin:
diff --git a/dev/favicon-16x16.png b/dev/favicon-16x16.png index 35f0e6235d587046c78a06f43bbaff7efcd161a2..fc4139179d9b9a937f2c373d547fe1dd6a499bc1 100644 GIT binary patch delta 71 zcmey%`ImEp1TzPR2tQwm-N%H@3e1{}A{HS=23CfqR)!|p1_o9J25B>FTPDY{$YMx{ MA8oam+{cm+0IJy%)*Davw`R0IZD@M*si- diff --git a/dev/favicon-32x32.png b/dev/favicon-32x32.png index f23e376ef0195f89e809038287a7e619194551e7..7219bc0a292e42f5eff0f15a6b291a6ab978f039 100644 GIT binary patch delta 69 zcmbQhKY@Qj6$gh1KR>hO!EYOzqS!<%LW~To3{8PZ+rYrez~I1pGlR(=*kmyzHg4+c JnXJg34*<1~6hQz0 delta 69 zcmbQhKY@Qj6$h)ZfJuk%3z3aYQEVcnA%>P#hGtf#M%o4jRt5$$x-aNX{=g=SA@TBB K#>B~r?D+t^Hx!is diff --git a/dev/news/index.html b/dev/news/index.html index 439a8b92..0601f9b3 100644 --- a/dev/news/index.html +++ b/dev/news/index.html @@ -75,7 +75,7 @@ pin_write() to make user-facing messages more clear (#770).
Improved documentation about Connect caches (#771) and deleting pin versions (#773).
- Added
board_deparse
forboard_url()
(#774).+ Fixed how
board_gdrive()
makes version directories (#780, @gorkang).Fixed how
board_gdrive()
handles dribble objects (#780, @gorkang and #782).
CRAN release: 2023-08-16
diff --git a/dev/pkgdown.yml b/dev/pkgdown.yml index a93d7618..a68a329c 100644 --- a/dev/pkgdown.yml +++ b/dev/pkgdown.yml @@ -8,7 +8,7 @@ articles: pins: pins.html posit-connect: posit-connect.html using-board-url: using-board-url.html -last_built: 2023-09-05T19:16Z +last_built: 2023-09-08T20:15Z urls: reference: https://pins.rstudio.com/reference article: https://pins.rstudio.com/articles diff --git a/dev/reference/board_register.html b/dev/reference/board_register.html index e67a1596..66c7d565 100644 --- a/dev/reference/board_register.html +++ b/dev/reference/board_register.html @@ -147,7 +147,7 @@board <- board_temp(versioned = TRUE)
board %>% pin_write(1:10, "x")
#> Guessing `type = 'rds'`
-#> Creating new version '20230905T191713Z-1d13c'
+#> Creating new version '20230908T201533Z-1d13c'
#> Writing to pin 'x'
board %>% pin_write(1:11, "x")
#> Guessing `type = 'rds'`
-#> Creating new version '20230905T191713Z-661c8'
+#> Creating new version '20230908T201533Z-661c8'
#> Writing to pin 'x'
board %>% pin_write(1:12, "x")
#> Guessing `type = 'rds'`
-#> Creating new version '20230905T191713Z-c9eb6'
+#> Creating new version '20230908T201534Z-c9eb6'
#> Writing to pin 'x'
board %>% pin_browse("x", local = TRUE)
-#> ℹ Pin at </tmp/Rtmpy2ZjRD/pins-18987f9959dd/x/20230905T191713Z-c9eb6>
+#> ℹ Pin at </tmp/RtmplkLbox/pins-187462ea93a7/x/20230908T201534Z-c9eb6>