0

I’m provided a link to a “private repository” URL on GitHub, where I and other collaborators will work on the same project. Now I need to create/publish an R package to that “private repo”, but the problem is I couldn’t create a package within that git repo (as the repo already had a .Rproj file).
How can I fix this? As I need to create package skeleton in the root folder of my Github. repository. Below are the details of how I do it. Please have a glance to better visualize my situation.

  1. Firstly, I try to clone the Git repo into my computer and name the project “my_git_repo” enter image description here
  2. Then, I try to create a new R package call “mypackage”, but then receive this message. (Which means I could actually create a new package inside the “my_git_repo” project but it’s not recommended to nest a package (a project) insides in a git repo.)
    enter image description here
NganKD
  • 71
  • 6
  • R packages are nothing else than structured directories and files (i.e. it **can't** have an arbitrary structure). So you can't have both; pushing it to an already existing repo AND have it not nested (except if the previous repo was empty maybe) - so *what* is it that you want? (Normally I'd have one repo per package). However, the Rproj file is not a necessary part of a package! – dario Oct 08 '21 at 13:11
  • @dario As I need to create a package skeleton in the root folder of my Github repo. But to have that package skeleton I need to use the function `usethis::create_package()` , which I believe would create a "new" project that has the skeleton inside it. – NganKD Oct 08 '21 at 13:20
  • @dario I'm thinking about creating a new R package just as usual, and then I'll copy all the skeleton files and paste them inside the Git repo project folder. Do you think it can fix the problem? – NganKD Oct 08 '21 at 13:22
  • @dario and yes, the previous repo is empty as you said! Sorry, I'm a newbie to Github and I don't know how these things work in git omg – NganKD Oct 08 '21 at 13:31
  • the message you are getting is from usethis and not git... You can set up the necessary files as you would without usethis in the case that you are not familiar with the package and don't want to read up on it. It's only a few files anyways.... – dario Oct 08 '21 at 13:33
  • And as implied before, if the dir is empty you might be fine by just going ahead (but again, setting it up by hand might be more familiar to you, no need to use usethis) – dario Oct 08 '21 at 13:35
  • Thank you @dario ! I'm still stuck though haha but you've given some ideas so I'm testing it now :) – NganKD Oct 08 '21 at 13:47

0 Answers0