diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..31d5365 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +inst/doc +docs diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..a6aad3d --- /dev/null +++ b/NEWS.md @@ -0,0 +1,8 @@ +# cputools 0.2 + +- Added functions to create Bioconductor, Travis and codecov shields + in markdown +- Added functions to make GitHub, Issues, package urls (see `pkg.R`) +- Added `pkgqst` to create a small section about questions and support + pointing to Github issues and/or Bioconductor support site. + \ No newline at end of file diff --git a/docs/authors.html b/docs/authors.html new file mode 100644 index 0000000..4f4840a --- /dev/null +++ b/docs/authors.html @@ -0,0 +1,100 @@ + + + +
+ + + + +A set up helper functions to standardise some R and package development and documentation.
+See also maker
and the CPU wiki.
See cputools()
for an list of functions:
library("cputools")
+cputools()
+## cputools functions:
+## biocVersions
+## color_picker
+## colour_picker
+## cputools
+## cpuwww
+## darken
+## ht
+## lighten
+## makeBiocBuildShield
+## makeBiocCovrShield
+## makeCodecovShield
+## makeDatName
+## makeFigName
+## makeGithubIssuesUrl
+## makeGithubPageUrl
+## makeGithubUrl
+## makeTravisShield
+## pdfpng
+## pkgqsts
+To get help: - Open a GitHub issue
+This function returns the current release and devel Bioconductor
+version numbers by parsing the
+"http://www.bioconductor.org/js/versions.js"
page.
biocVersions()
+
+ A named character
of length two with the
+ release
and devel
version numbers (in that
+ order).
+biocVersions()#> release devel +#> "3.4" "3.5"
Print all available (exported) cputools functions.
+ + +cputools()
+
+ Used for its side effect of print a list of available +helper functions.
+ + ++cputools()#> cputools functions: +#> biocVersions +#> color_picker +#> colour_picker +#> cputools +#> cpuwww +#> darken +#> ht +#> lighten +#> makeBiocBuildShield +#> makeBiocCovrShield +#> makeCodecovShield +#> makeDatName +#> makeFigName +#> makeFileName +#> makeGithubIssuesUrl +#> makeGithubPageUrl +#> makeGithubUrl +#> makeTravisShield +#> mrkToUrl +#> pdfpng +#> pkgqsts +#> validUrl
Light and dark colours
+ + +darken(color, factor = 1.4) + +lighten(color, factor = 1.4)+ +
A new rgb colour
+ +From https://gist.github.com/Jfortin1/72ef064469d1703c6b30.
+ + ++darkFirebrick <- darken("firebrick") +lightFirebrick <- lighten("firebrick") +plot(c(1.5, 2, 2.5), c(1, 1.25, 1), + pch = 19, cex = 150, + col = c(darkFirebrick, "firebrick", lightFirebrick))
Look at head and tail in one go.
+ + +ht(x, ...)+ +
head
/tail
are defined.head
and tail
.Invisibly returns NULL
.
+ht(letters)#> [1] "a" "b" "c" "d" "e" "f" +#> ... +#> [1] "u" "v" "w" "x" "y" "z"ht(freeny.x, n = 3)#> lag quarterly revenue price index income level market potential +#> [1,] 8.79636 4.70997 5.82110 12.9699 +#> [2,] 8.79236 4.70217 5.82558 12.9733 +#> [3,] 8.79137 4.68944 5.83112 12.9774 +#> ... +#> lag quarterly revenue price index income level market potential +#> [37,] 9.71774 4.29627 6.18768 13.1579 +#> [38,] 9.74924 4.27839 6.19377 13.1625 +#> [39,] 9.77536 4.27789 6.20030 13.1664
biocVersions
cputools
cpuwww
ht
pdfpng
Creates a file name given a prefix and other optional paramters +for a figure or data file. Also checks if file exists.
+ + +makeFigName(prefix, ext = "pdf", prefix0 = "Fig", date = TRUE, + path = ".") + +makeDatName(prefix, ext = "rda", prefix0 = "Dat", date = TRUE, + path = ".")+ +
pdf
for a figure and
+rda
for a data file.Fig
for a figure and Dat
for a data file.date
) be used
+as part of the file name? Default is TRUE
."."
.A character
with the figure file name.
TODO: If file exists, create the next increment.
+ + ++makeFigName("foo")#> [1] "./Fig-foo-Mon-Jan--2-17:04:25-2017.pdf"makeFigName("foo", date = FALSE)#> [1] "./Fig-foo.pdf"makeDatName("foo", date = FALSE)#> [1] "./Dat-foo.rda"makeFigName("foo", path = "~/projects/big-project/figs")#> [1] "~/projects/big-project/figs/Fig-foo-Mon-Jan--2-17:04:25-2017.pdf"makeDatName("foo", path = "~/projects/big-project/Data")#> [1] "~/projects/big-project/Data/Dat-foo-Mon-Jan--2-17:04:25-2017.rda"
Plot to the pdf and png devices at once.
+ + +pdfpng(expr, fn)+ +
Produces the files fn.pdf
and fn.png
.
+p <- quote({ + plot(1:10) + points(10:1) +}) +pdfpng(p, "myfig")#> pdf +#> 2
Generates a markdown section on where to ask questions about a +package.
+ + +makeGithubUrl(pkg, user = options()[["GitHubUserName"]]) + +makeGithubPageUrl(pkg, user = options()[["GitHubUserName"]]) + +makeGithubIssuesUrl(pkg, user = options()[["GitHubUserName"]]) + +pkgqsts(pkg, github = TRUE, bioc = TRUE, level = 1L, + user = options()[["GitHubUserName"]])+ +
character
with the package name. Must
+be of length one for codepkgqsts. Other functions
+makeGithubPageUrl
and makeGithubIssuesUrl
are
+vectorised.options()[["GitHubUserName"]]
.logical
(default is TRUE
) defining
+whether users can ask questions on GitHub issues.logical
(default is TRUE
) defining
+whether users can ask questions on the Bioconductor support
+forum.1L
for
+#
. Use 2L
for ##
and so on.A character
with Github URLs.
A character
with Github page URLs.
A character
with Github page URLs.
Invisibly returns NULL
. Used for its side effect.
+makeGithubUrl("pRoloc", user = "lgatto")#> pRoloc +#> "https://github.com/lgatto/pRoloc"makeGithubUrl(c("pRoloc", "pRolocGUI"), user = "lgatto")#> pRoloc pRolocGUI +#> "https://github.com/lgatto/pRoloc" "https://github.com/lgatto/pRolocGUI"makeGithubPageUrl("pRoloc", user = "lgatto")#> [1] "https://lgatto.github.io/pRoloc"makeGithubPageUrl(c("pRoloc", "pRolocGUI"), user = "lgatto")#> [1] "https://lgatto.github.io/pRoloc" "https://lgatto.github.io/pRolocGUI"makeGithubIssuesUrl("pRoloc", user = "lgatto")#> [1] "https://github.com/lgatto/pRoloc/issues"makeGithubIssuesUrl(c("pRoloc", "pRolocGUI"), user = "lgatto")#> [1] "https://github.com/lgatto/pRoloc/issues" +#> [2] "https://github.com/lgatto/pRolocGUI/issues"pkgqsts("pRoloc", user = "lgatto")#> # Questions and support +#> To get help: +#> - Open a GitHub [issue](https://github.com/lgatto/pRoloc/issues) +#> - Post your question on the [Bioconductor support site](https://support.bioconductor.org/)pkgqsts("cputools", bioc = FALSE, user = "lgatto")#> # Questions and support +#> To get help: +#> - Open a GitHub [issue](https://github.com/lgatto/cputools/issues)
Functions to generate package travis-ci, codecov, Bioconductor +build status and Biocondcutor test coverage shields
+ + +makeTravisShield(pkg, user = options()[["GitHubUserName"]], + branch = "master") + +makeCodecovShield(pkg, user = options()[["GitHubUserName"]], + branch = "master") + +makeBiocBuildShield(pkg, branch = c("devel", "release")) + +makeBiocCovrShield(pkg, branch = c("devel", "release"))+ +
character
with the package name(s). If
+of length greater than one, then must of of same length as
+user
and branch
.options()[["GitHubUserName"]]
. Argument is not recycled
+of more than one package is provided."master"
. Argument is not recycled of more than one
+package is provided. For Bioconductor shields (functions
+makeBiocBuildShield
and makeBiocCovrShield
),
+branch is one of "devel"
(default) or "release"
.A character
with the shield in markdown.
+makeTravisShield("pRoloc", user = "lgatto")#> [](https://travis-ci.org/lgatto/pRoloc)## default user +options(GitHubUserName = "ComputationalProteomicsUnit") +makeCodecovShield("cputools")#> [](https://codecov.io/gh/ComputationalProteomicsUnit/cputools)makeCodecovShield("MSnbase", user = "lgatto")#> [](https://codecov.io/gh/lgatto/MSnbase)makeBiocBuildShield("MSnbase")#> [](http://bioconductor.org/packages/devel/bioc/html/MSnbase.html)makeBiocBuildShield("MSnbase", branch = "release")#> [](http://bioconductor.org/packages/release/bioc/html/MSnbase.html)makeBiocCovrShield("MSnbase")#> [](https://codecov.io/github/Bioconductor-mirror/MSnbase/branch/master)makeBiocCovrShield("MSnbase", branch = "release")#> [](https://codecov.io/github/Bioconductor-mirror/MSnbase/branch/release-3.4)