Skip to content

Commit

Permalink
Add code to create package from existing github repo
Browse files Browse the repository at this point in the history
  • Loading branch information
robjhyndman committed Mar 11, 2024
1 parent 71e54b3 commit e314532
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
15 changes: 12 additions & 3 deletions week3/doubler.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@ devtools::dev_sitrep()

library(devtools)
# Create package with one function that doubles numbers
create_package("/tmp/doubler")
setwd("/tmp/doubler")
use_git()

# Since github already set up, we will do that first

create_from_github(
repo_spec = "numbats/assignment-1-package-creation-robjhyndman",
destdir = "~/Desktop/",
protocol = "ssh"
)
# Rename folder and Rproj to your package name
create_package("~/Desktop/doubler")
use_github_links()

use_gpl3_license()


Expand Down
26 changes: 21 additions & 5 deletions week3/slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,12 @@ install.packages(c("devtools", "roxygen2", "testthat", "knitr"))

### Verify
\vspace*{-0.2cm}
`devtools::dev_sitrep()`

```{r}
#| eval: false
library(devtools)
dev_sitrep()
```

## Package states

Expand Down Expand Up @@ -210,10 +215,21 @@ install.packages(c("devtools", "roxygen2", "testthat", "knitr"))

## Exercise: Start on your package

```{r}
#| eval: false
usethis::create_package()
```
1. Because we have already set up github repos for everyone, we need to first clone the repo to your local machine. Then we can start working on the package.

```{r}
#| eval: false
create_from_github("numbats/assignment-1-package-creation-robjhyndman")
```
2. Rename folder and Rproj file to your package name
3. Create package skeleton
```{r}
#| eval: false
create_package()
```
## Workflow
Expand Down

0 comments on commit e314532

Please sign in to comment.