# Navigate where you want your folder to be located
setwd("C:/Users/chief/Documents/Github")
# Assumes usethis is installed
usethis::create_package("foo")
# Say yes or no to next (annoying) popup window, it doesn't matter.
# Add a test environment
setwd("foo")
usethis::use_testthat()
# Add your first test function to at least get something in that folder.
# Go to foo\tests\testthat
# and add this file with a name that begins with 'test_'
context("foo")
library(foo)
test_that("I'm testing something", {
# do something with your code
expect_equal(1:4, 1:4)
})
# After writing a function with roxygen comments, roxygenize your package
roxygen2::roxygenise()
# Then click "Check" under RStudio's Build tab
# You may get a warning about "Non-standard license specification".
# To clean that up, see below.
# Keep changing your code and roxygenizing until your package checks out clean.
# Once no errors, click "Install and Restart" next to "Check" and you're done.
You're Done! # Don't forget! # The only thing roxygen doesn't handle is, # whenever you add new functionality from another package, # you have have to change DESCRIPTION. License Assuming you just go GPL Open DESCRIPTION Replace "What license it uses" with GPL-3 | file LICENSE and put a file named LICENSE in the same directory as DESCRIPTION. For me, this file content sufficed Something about GPL but the GNU community would probably prefer you used the one here https://www.gnu.org/licenses/gpl-3.0.txt
# Once no errors, click "Install and Restart" next to "Check" and you're done.
You're Done! # Don't forget! # The only thing roxygen doesn't handle is, # whenever you add new functionality from another package, # you have have to change DESCRIPTION. License Assuming you just go GPL Open DESCRIPTION Replace "What license it uses" with GPL-3 | file LICENSE and put a file named LICENSE in the same directory as DESCRIPTION. For me, this file content sufficed Something about GPL but the GNU community would probably prefer you used the one here https://www.gnu.org/licenses/gpl-3.0.txt