Skip to content

Commit e185808

Browse files
committed
Add R package basics
1 parent 5024954 commit e185808

File tree

10 files changed

+158
-1
lines changed

10 files changed

+158
-1
lines changed

.Rbuildignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.*\.Rproj$
2+
^\.Rproj\.user$
3+
^README.Rmd
4+
^\.github$
5+
^doc$
6+
^Meta$
7+
^codecov\.yml$
8+
^_pkgdown\.yml$
9+
^docs$
10+
^pkgdown$
11+
Dockerfile
12+
^LICENSE
13+
^action.yml$
14+
15+
node_modules$
16+
package-lock\.json$
17+
package\.json$

.Rhistory

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ biocthis::use_bioc_description()
33
biocthis::use_bioc_description("test")
44
biocthis::use_bioc_description("testytest")
55
?remotes::install_cran()
6+
devtools::build()

.gitignore

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# R project files
2+
*.Rproj
3+
.Rproj.user
4+
.Ruserdata
5+
# History files
6+
.Rhistory
7+
.Rapp.history
8+
# Session Data files
9+
.RData
10+
# User-specific files
11+
.Ruserdata
12+
# .DS_Store
113
# find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
214
.DS_Store
315
./.DS_Store
@@ -7,4 +19,25 @@
719
./**/**/**/**/.DS_Store
820
./**/**/**/**/**/.DS_Store
921
./**/**/**/**/**/**/.DS_Store
10-
.Rproj.user
22+
# Example code in package build process
23+
*-Ex.R
24+
# Output files from R CMD build
25+
/*.tar.gz
26+
# Output files from R CMD check
27+
/*.Rcheck/
28+
# RStudio files
29+
.Rproj.user/
30+
# produced vignettes
31+
vignettes/*.html
32+
vignettes/*.pdf
33+
vignettes/*.R
34+
# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
35+
.httr-oauth
36+
# knitr and R markdown default cache directories
37+
*_cache/
38+
/cache/
39+
# Temporary files created by R markdown
40+
*.utf8.md
41+
*.knit.md
42+
# R Environment Variables
43+
.Renviron

DESCRIPTION

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Package: rworkflows
2+
Type: Package
3+
Title: packageTitle
4+
Version: 0.99.0
5+
Authors@R: c(
6+
person(given = "yourGivenName",
7+
family = "yourFamilyName",
8+
role = c("cre"),
9+
email = "[email protected]",
10+
comment = c(ORCID = "yourOrcidId"))
11+
)
12+
Description: packageDescription.
13+
URL: https://github.com/neurogenomics/r_workflows
14+
BugReports: https://github.com/neurogenomics/r_workflows/issues
15+
Encoding: UTF-8
16+
Depends: R (>= 4.2)
17+
biocViews:
18+
Genetics, FunctionalGenomics, SystemsBiology
19+
Suggests:
20+
markdown,
21+
rmarkdown,
22+
magick,
23+
remotes,
24+
knitr,
25+
BiocStyle,
26+
covr,
27+
testthat (>= 3.0.0),
28+
badger
29+
RoxygenNote: 7.2.1.9000
30+
VignetteBuilder: knitr
31+
License: GPL-3
32+
Config/testthat/edition: 3

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Generated by roxygen2: do not edit by hand
2+

R/message_parallel.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#' Message parallel
2+
#'
3+
#' Send messages to console even from within parallel processes
4+
#' @return Null
5+
#' @keywords internal
6+
message_parallel <- function(...) {
7+
system(sprintf('echo "%s"', paste0(..., collapse = "")))
8+
}

R/messager.R

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#' Print messages
2+
#'
3+
#' Conditionally print messages.
4+
#' Allows developers to easily control verbosity of functions,
5+
#' and meet Bioconductor requirements that dictate the message
6+
#' must first be stored to a variable before passing to \link[base]{message}.
7+
#'
8+
#' @param v Whether to print messages or not.
9+
#' @param parallel Whether to enable message print when wrapped
10+
#' in parallelised functions.
11+
#'
12+
#' @return Null
13+
#' @keywords internal
14+
messager <- function(..., v = TRUE, parallel = FALSE) {
15+
if(parallel){
16+
if(v) try({message_parallel(...)})
17+
} else {
18+
msg <- paste(...)
19+
if (v) try({message(msg)})
20+
}
21+
}

man/message_parallel.Rd

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/messager.Rd

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r_workflows.Rproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ Encoding: UTF-8
1111

1212
RnwWeave: Sweave
1313
LaTeX: pdfLaTeX
14+
15+
BuildType: Package
16+
PackageUseDevtools: Yes
17+
PackageInstallArgs: --no-multiarch --with-keep.source

0 commit comments

Comments
 (0)