Skip to content

Commit 5bdb47e

Browse files
Update README.md
1 parent b81fbd8 commit 5bdb47e

File tree

1 file changed

+168
-2
lines changed

1 file changed

+168
-2
lines changed

README.md

Lines changed: 168 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,168 @@
1-
# myRpackage
2-
A starter R package scaffold, structured for publication on CRAN, with boilerplate files and metadata to begin development immediately.
1+
# myrpackage
2+
3+
A starter R package scaffold, structured for publication on [CRAN](https://cran.r-project.org/), with boilerplate files and metadata to begin development immediately.
4+
5+
---
6+
7+
## 📁 File Tree
8+
9+
```text
10+
myrpackage/
11+
├── DESCRIPTION # Package metadata
12+
├── NAMESPACE # Generated from roxygen2 docs
13+
├── R/
14+
│ └── hello.R # Example R function with documentation
15+
├── man/
16+
│ └── hello.Rd # Generated manual file
17+
├── tests/
18+
│ └── testthat/
19+
│ └── test-hello.R # Unit test
20+
│ └── testthat.R # Testthat runner setup
21+
├── vignettes/
22+
│ └── intro.Rmd # Long-form documentation (optional)
23+
├── .Rbuildignore # Files ignored during build
24+
├── .gitignore # Git ignore rules
25+
├── LICENSE # Open-source license (MIT recommended)
26+
└── README.md # Project overview and usage
27+
```
28+
29+
---
30+
31+
## 📦 DESCRIPTION (Example)
32+
33+
```r
34+
Package: myrpackage
35+
Type: Package
36+
Title: What the Package Does (One Line, Title Case)
37+
Version: 0.0.0.9000
38+
Authors@R:
39+
person(given = "First", family = "Last", email = "[email protected]", role = c("aut", "cre"))
40+
Description: A short description of what the package does.
41+
License: MIT + file LICENSE
42+
Encoding: UTF-8
43+
LazyData: true
44+
RoxygenNote: 7.3.0
45+
```
46+
47+
---
48+
49+
## 📄 R/hello.R
50+
51+
```r
52+
#' Say Hello
53+
#'
54+
#' This function prints a friendly greeting.
55+
#'
56+
#' @return No return value, called for side effects.
57+
#' @export
58+
hello <- function() {
59+
print("Hello, world!")
60+
}
61+
```
62+
63+
---
64+
65+
## 🧪 tests/testthat/test-hello.R
66+
67+
```r
68+
test_that("hello() prints correctly", {
69+
expect_output(hello(), "Hello, world!")
70+
})
71+
```
72+
73+
---
74+
75+
## 📄 tests/testthat.R
76+
77+
```r
78+
library(testthat)
79+
library(myrpackage)
80+
81+
test_check("myrpackage")
82+
```
83+
84+
---
85+
86+
## 📄 .Rbuildignore
87+
88+
```text
89+
^README\.md$
90+
^\.gitignore$
91+
^\.Rproj\.user$
92+
^\.Rhistory$
93+
^\.RData$
94+
^\.DS_Store$
95+
^vignettes/
96+
```
97+
98+
---
99+
100+
## 📄 LICENSE (MIT Example)
101+
102+
```
103+
MIT License
104+
105+
Copyright (c) 2025 Your Name
106+
107+
Permission is hereby granted, free of charge, to any person obtaining a copy...
108+
```
109+
110+
---
111+
112+
## 📄 vignettes/intro.Rmd (Optional)
113+
114+
````rmd
115+
---
116+
title: "Getting Started with myrpackage"
117+
output: rmarkdown::html_vignette
118+
vignette: >
119+
%\VignetteIndexEntry{Getting Started}
120+
%\VignetteEngine{knitr::rmarkdown}
121+
%\VignetteEncoding{UTF-8}
122+
---
123+
124+
```{r setup, include = FALSE}
125+
library(myrpackage)
126+
````
127+
128+
This is an introduction to using the package.
129+
130+
````
131+
132+
---
133+
134+
## 🚀 Development Workflow
135+
136+
1. **Set up the package in RStudio or manually**:
137+
```r
138+
usethis::create_package("myrpackage")
139+
usethis::use_git()
140+
usethis::use_mit_license()
141+
usethis::use_roxygen_md()
142+
usethis::use_testthat()
143+
devtools::document()
144+
````
145+
146+
2. **Check your package**:
147+
148+
```r
149+
devtools::check()
150+
```
151+
152+
3. **Install locally**:
153+
154+
```r
155+
devtools::install()
156+
```
157+
158+
4. **Submit to CRAN**:
159+
160+
```r
161+
devtools::release()
162+
```
163+
164+
---
165+
166+
## ✅ Summary
167+
168+
This scaffold provides everything needed to start building an R package with good development hygiene, testing, documentation, and CRAN readiness.

0 commit comments

Comments
 (0)