pins-r icon indicating copy to clipboard operation
pins-r copied to clipboard

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

Open xinzhuohkust opened this issue 11 months ago • 1 comments

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

xinzhuohkust avatar Mar 05 '24 15:03 xinzhuohkust

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:

  • Step 1
## 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

  • Step 2

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

juliasilge avatar Mar 05 '24 18:03 juliasilge