rstudio / pins-r

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

Error in x[[length(x)]] : attempt to select less than one element in integerOneIndex #821

Open xinzhuohkust opened 4 months ago

xinzhuohkust commented 4 months ago

I’ve stored my files on OneDrive. I saved a file named 'sample' using the pin_write function on one computer. However, when I try to open this file on another computer using pin_read, I encounter the following error:

Error in x[[length(x)]] :
  attempt to select less than one element in integerOneIndex
juliasilge commented 4 months ago

Can you create a reprex (a minimal reproducible example) for this? The goal of a reprex is to make it easier for us to recreate your problem so that we can understand it and/or fix it. If you've never heard of a reprex before, you may want to start with the tidyverse.org help page. Thanks! 🙌

Here is an example of what would be helpful to see:

## write the data
library(pins)
drv <- Microsoft365R::get_personal_onedrive()
#> Loading Microsoft Graph login for tenant 'consumers'
board <- board_ms365(drv, "pins-testing")
board |> pin_write(sample(1:100, 10), "really-great-numbers", type = "json")
#> Creating new version '20240305T182506Z-66f83'
#> Writing to pin 'really-great-numbers'

## delete the cache locally, so it is like we're starting fresh
fs::dir_delete(board$cache)

Created on 2024-03-05 with reprex v2.1.0

Restart R and then:

## read the data
library(pins)
drv <- Microsoft365R::get_personal_onedrive()
#> Loading Microsoft Graph login for tenant 'consumers'
board <- board_ms365(drv, "pins-testing")
board |> pin_read("really-great-numbers")
#>  [1] 82 23 57  4  6 21  2 88 41 63

Created on 2024-03-05 with reprex v2.1.0