Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/evamaerey/r2pmarch20test


https://github.com/evamaerey/r2pmarch20test

Last synced: 11 days ago
JSON representation

Awesome Lists containing this project

README

        

---
output:
github_document:
toc: TRUE
toc_depth: 2
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
eval = T
)
```

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)

# Part 0. Proposal

Proposing the {r2pmarch20test} package! 🦄

The goal of {r2pmarch20test} is to make ... easier.

Without the package, we live in the effort-ful world that follows 🏋:

```{r}
x <- 4

2*x

```


With the {r2pmarch20test} package, we'll live in a different world (🦄 🦄 🦄) where the task is a snap 🫰:

Proposed API:

```

library(r2pmarch20test)

r2pmarch20test::times_two(x = 4)

```

# Part I. Work out functionality ✅

Here is a function that will do some work...

```{r times_two}
times_two <- function(x){

x*2

}
```

## Try it out

```{r}
times_two(4)
```

# Part II. Packaging and documentation 🚧 ✅

## Phase 1. Minimal working package

### Bit A. Created package archetecture, running `devtools::create(".")` in interactive session. 🚧 ✅

```{r, eval = F}
devtools::create(".")
```

### Bit B. Managing [dependencies](https://r-pkgs.org/dependencies-in-practice.html)? 🚧 ✅

Package dependencies managed, i.e. `depend::function()` in proposed functions and declared in the DESCRIPTION

```{r, eval = F}
usethis::use_package("ggplot2")
```

### Bit C. Moved functions [R code folder](https://r-pkgs.org/code.html)? 🚧 ✅

Use new {readme2pkg} function to do this from readme...

```{r, eval = F}
readme2pkg::chunk_to_r(chunk_name = "times_two")
```

### Bit D. Run [`devtools::check()`](https://r-pkgs.org/whole-game.html#check) and address all *errors.* 🚧 ✅

```{r, eval = F}
devtools::check(pkg = ".")
```

devtools::check() will document the functions for you once exported; check the 'man' folder.

### Bit E. [Install](https://r-pkgs.org/whole-game.html#install) and restart package 🚧 ✅

```{r, eval = F}
devtools::install(pkg = ".")
```

### Bit F. Write traditional README that uses built package (also serves as a test of build). 🚧 ✅

The goal of the {r2pmarch20test} package is to ...

Install package with:

```
remotes::installgithub("EvaMaeRey/r2pmarch20test")
```

Once functions are exported you can remove go to two colons, and when things are are really finalized, then go without colons (and rearrange your readme...)

```{r, eval = F}
library(r2pmarch20test) ##<< change to your package name here
r2pmarch20test:::times_two(10)
```

### Bit G. Add [lifecycle badge](https://r-pkgs.org/lifecycle.html) (experimental) 🚧 ✅

```{r, eval = F}
usethis::use_lifecycle_badge("experimental")
```

### Bit H. Push to github.

In RStudio: Console/Terminal/Job pane

Chose terminal tab. Then

- git add .
- git commit -m "first commit"
- git push

## Phase 2: Listen & iterate 🚧 ✅

Try to get feedback from experts on API, implementation, default decisions. Is there already work that solves this problem?

## Phase 3: Settling and testing 🚧 ✅

### Bit A. Added a description and author information in the [DESCRIPTION file](https://r-pkgs.org/description.html) 🚧 ✅

### Bit B. Added [roxygen skeleton](https://r-pkgs.org/man.html)? 🚧 ✅

Use a roxygen skeleton for auto documentation and making sure proposed functions are *exported*. (in RStudio 'Code -> insert Roxygen Skeleton) Generally, early on, I don't do much (anything) in terms of filling in the skeleton for documentation, because things may change.

### Bit C. Chosen a [license](https://r-pkgs.org/license.html)? 🚧 ✅

```{r, eval = F}
usethis::use_mit_license()
```

### Bit D. Settle on [examples](https://r-pkgs.org/man.html#sec-man-examples). Put them in the roxygen skeleton and readme. 🚧 ✅

### Bit E. Written formal [tests](https://r-pkgs.org/testing-basics.html) of functions and save to test that folders 🚧 ✅

That would look like this...

```{r test_calc_times_two_works, eval = F}
library(testthat)

test_that("calc times 2 works", {
expect_equal(times_two(4), 8)
expect_equal(times_two(5), 10)

})
```

```{r, eval = F}
readme2pkg::chunk_to_tests_testthat("test_calc_times_two_works")
```

### Bit F. Check again. Addressed notes, warnings and errors. 🚧 ✅

```{r, eval = F}
devtools::check(pkg = ".")
```

## Phase 4. Promote to wider audience... 🚧 ✅

### Bit A. Package website built? 🚧 ✅

### Bit B. Package website deployed? 🚧 ✅

## Phase 5: Harden/commit: Submit to CRAN/RUniverse 🚧 ✅

# Appendix: Reports, Environment

## Description file complete? 🚧 ✅

```{r, eval = F}
readLines("DESCRIPTION")
```

## Environment 🚧 ✅

Here I just want to print the packages and the versions

```{r}
all <- sessionInfo() |> print() |> capture.output()
all[11:17]
```

## `devtools::check()` report

```{r, eval=F, error = T, results="hide", warning=F}
devtools::check(pkg = ".")
```

## Package directory file tree

```{r}
fs::dir_tree(recurse = T)
```