Set Repo in .Rprofile - Error in data.frame...

Hi.

I'm using a .Rprofile file in my user Documents folder in Windows and to set the desired repository i use the command:

options(repos = 'https://packagemanager.posit.co/cran/2023-08-21')

Using getOption("repos") i get: "https://packagemanager.posit.co/cran/2023-08-21", as i expected.

But out of nowhere a message is printed in my console:

Error in data.frame(name = names(getOption("repos")), host = "", url = as.character(getOption("repos")), :
arguments imply differing number of rows: 0, 1

Absolutelly randomlly this message appears, even if i dont do anything in the console.

Any ideias?

My session:

R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.1252

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

other attached packages:
[1] fable_0.3.3 feasts_0.3.1 fabletools_0.3.4
[4] tsibbledata_0.4.1 tsibble_1.1.3 ggplot2_3.4.3
[7] lubridate_1.9.2 tidyr_1.3.0 dplyr_1.1.2
[10] tibble_3.2.1 fpp3_0.5

loaded via a namespace (and not attached):
[1] Rcpp_1.0.11 progressr_0.14.0 pillar_1.9.0
[4] compiler_4.1.3 tools_4.1.3 digest_0.6.33
[7] lifecycle_1.0.3 gtable_0.3.3 anytime_0.3.9
[10] timechange_0.2.0 pkgconfig_2.0.3 rlang_1.1.1
[13] cli_3.6.1 rstudioapi_0.15.0 xfun_0.40
[16] withr_2.5.0 knitr_1.42 generics_0.1.3
[19] vctrs_0.6.3 rappdirs_0.3.3 grid_4.1.3
[22] tidyselect_1.2.0 glue_1.6.2 R6_2.5.1
[25] fansi_1.0.4 distributional_0.3.2 farver_2.1.1
[28] purrr_1.0.2 magrittr_2.0.3 codetools_0.2-18
[31] scales_1.2.1 ellipsis_0.3.2 rsconnect_1.0.2
[34] colorspace_2.1-0 labeling_0.4.2 utf8_1.2.3
[37] munsell_0.5.0 crayon_1.5.2

RStudio 2023.03.1+446 "Cherry Blossom" Release (6e31ffc3ef2a1f81d377eeccab71ddc11cfbd29e, 2023-05-09) for windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2023.03.1+446 Chrome/108.0.5359.179 Electron/22.0.3 Safari/537.36

I don't know where the error is coming from, but it is best to set repos to a named vector. E.g. this is what I have in an amd64 Ubuntu 22.04 container:

> dput(getOption("repos"))
c(P3M = "https://packagemanager.posit.co/cran/__linux__/jammy/latest",
CRAN = "https://cloud.r-project.org")

Thanks for the help. I changed for

repo['Posit_2023-08-21'] <- 'https://packagemanager.posit.co/cran/2023-08-21'

and it seems to fix the problem.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.