Having problems calling load_all()

I am developing a package and having a problem making a function available for experimentation. Every time I call load_all(), it throws " Overwrite pre-existing file 'Pckg.Rproj'?". It just keeps asking every time, whatever my answer may be (positive or negative). I tried to quit by typing 0, It didn't work.

This is most likely an error in your package. If you show us the package, we can probably help.

1 Like

Thanks for replying. I am actually creating a toy package for the purpose of getting familiar with the process of package development. Here is the code I have written so far:

#Developping a small toy package:

Loading the required package: usethis

library(devtools)

#initialize a new package in a directory on your computer

getwd()
setwd("C:/Users/Mylptp/Desktop/R/Prog/stpckg")

create_package("C:/Users/Mylptp/Desktop/R/Prog/stpckg")

#Making a Git repository
use_git()

#Write the first function

x <- "alfa,bravo,charlie,delta"
strsplit(x, split = ",") #split a single string into many parts
#(the output is a list)
str(strsplit(x, split = ",")) #str() is an alternative to summary()

#methods of unlisting the result
unlist(strsplit(x, split = ","))
strsplit(x, split = ",")[[1]]

#The second, safer solution is the basis for the inaugural function of stpckg: strsplit1()

strsplit1 <- function(x, split) {
strsplit(x, split = split)[[1]]
}
strsplit1("I,love,all,of,you",",")

#Saving the definition of strsplit1() in a .R file.
use_r("strsplit1")

#Calling load_all() to make strsplit1() available for experimentation
load_all() #didn't work:

#Problems with the cli package
install.packages("devtools")
install.packages("cli")
library("devtools")
install.packages("shiny")

packageVersion("cli")
update.packages("cli")

remove.packages("cli")
install.packages("cli")
install.packages("htmlwidgets")
library("devtools") #FINALLY DONE !

load_all() # Here where lies the problem !!!!

Here is what I get every time I call "load_all()"

load_all()
i Loading stpckg
v Setting active project to 'C:/Users/Mylptp/Desktop/R/Prog/stpckg'
Package: stpckg
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R (parsed):
* First Last first.last@example.com [aut, cre] (YOUR-ORCID-ID)
Description: What the package does (one paragraph).
License: use_mit_license(), use_gpl3_license() or friends to
pick a license
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Overwrite pre-existing file 'stpckg.Rproj'?

1: Absolutely
2: Negative
3: Absolutely not

Sélection : 2
v Leaving 'stpckg.Rproj' unchanged
v Opening 'C:/Users/Mylptp/Desktop/R/Prog/stpckg' in new RStudio session
v Setting active project to ''
v Setting active project to 'C:/Users/Mylptp/Desktop/R/Prog/stpckg'
List of 1
$ : chr [1:4] "alfa" "bravo" "charlie" "delta"

  • Modify 'R/strsplit1.R'
    i Loading stpckg
    v Setting active project to 'C:/Users/Mylptp/Desktop/R/Prog/stpckg'
    Package: stpckg
    Title: What the Package Does (One Line, Title Case)
    Version: 0.0.0.9000
    Authors@R (parsed):
    • First Last first.last@example.com [aut, cre] (YOUR-ORCID-ID)
      Description: What the package does (one paragraph).
      License: use_mit_license(), use_gpl3_license() or friends to
      pick a license
      Encoding: UTF-8
      Roxygen: list(markdown = TRUE)
      RoxygenNote: 7.2.3
      Overwrite pre-existing file 'stpckg.Rproj'?

1: Absolutely not
2: Yup
3: Not now

Sélection :

I am sorry, but this is a bit hard to follow. Can you put your package on GitHub, or create a .tar.gz file for it, and upload it somewhere?

1 Like

For sure.
Here is a link to the raw file on Github:
https://raw.githubusercontent.com/ovsama/Package-development/main/newproject_regexcite.R?token=GHSAT0AAAAAACNLL7VYBGXXM5HJJ24B3EP6ZNST54A

I get a 404 error when I try that link. Looking at your GitHub profile, I think your repository "Package-development" is private. For us to help you, could you please either 1) make that repository public, or 2) create a new public repository that contains the code to reproduce the load_all() error?