Title: | Miscellaneous Functions by 'Colin Millar' |
---|---|
Description: | Miscellaneous functions. |
Authors: | Colin Millar [aut, cre] |
Maintainer: | Colin Millar <[email protected]> |
License: | GPL-3 |
Version: | 0.0.0.9002 |
Built: | 2024-11-15 02:50:19 UTC |
Source: | https://github.com/colinpmillar/cpmtools |
adds roxygen documentation headers to the top on R function and optionally write this to a file in the R folder.
add.roxy(obj, file = FALSE)
add.roxy(obj, file = FALSE)
obj |
the function to create documentation for |
file |
if TRUE write to file (R/function name.R), Default: FALSE |
TRUE if successful, FALSE if not
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
Functions to make pleasing doodles
canvas() paradox( shape, dist = 0.05, reverse = FALSE, cols = colorRampPalette(c("red", "blue"))(40), debug = FALSE ) paradoxes(shapes, dist = 0.05, cols = colorRampPalette(c("red", "blue"))(40)) scale_shape(shape, scale = 1, shift = 0)
canvas() paradox( shape, dist = 0.05, reverse = FALSE, cols = colorRampPalette(c("red", "blue"))(40), debug = FALSE ) paradoxes(shapes, dist = 0.05, cols = colorRampPalette(c("red", "blue"))(40)) scale_shape(shape, scale = 1, shift = 0)
shape |
a matrix with colums x and y definining a shape to doodle within, can be any closed polygon, but some shapes work better than others. |
dist |
the distance up the adjacent edge where each new line will be drawn, default 0.05 |
reverse |
should the shape be drawn in reverse order (see examples) |
cols |
a palate of colours as a vector of strings interpretable as colours |
debug |
should debug messages be produces (default FALSE) |
shapes |
a list of shapes (polygons) to doodle within |
scale |
if scaling, how much to scale by |
shift |
if scaling, should the shape also be shifted and by how much |
displays a plot
if (interactive()) { triangle <- cbind(x = c(0, 1, .7), y = c(0, 0.1, 1)) triangle2 <- cbind(x = c(0, 0, .7), y = c(0, 1, 1)) square <- cbind(x = c(0, 1, 1, 0), y = c(0, 0, 1, 1)) canvas() paradox(square, 0.03) canvas() paradox(triangle, 0.042) paradox(triangle2, 0.042) canvas() paradox(scale_shape(square, c(0.5, 1)), 0.03) paradox(scale_shape(square, c(0.5, 1), c(0.5, 0)), 0.05, reverse = TRUE) canvas() dist <- 0.02 paradox(scale_shape(square, .5), dist) paradox(scale_shape(square, .5, c(0.5, 0)), dist, reverse = TRUE) paradox(scale_shape(square, .5, .5), dist) paradox(scale_shape(square, .5, c(0, 0.5)), dist, reverse = TRUE) canvas() dist <- 0.02 paradox(scale_shape(square, .5), dist, reverse = TRUE) paradox(scale_shape(square, .5, c(0.5, 0)), dist, reverse = TRUE) paradox(scale_shape(square, .5, .5), dist, reverse = TRUE) paradox(scale_shape(square, .5, c(0, 0.5)), dist, reverse = TRUE) canvas() dist <- 0.02 cols1 <- colorRampPalette(c("red", "blue"))(30) cols2 <- colorRampPalette(c("blue", "red"))(30) cols3 <- colorRampPalette(c("green", "purple"))(30) cols4 <- colorRampPalette(c("purple", "green"))(30) paradox(scale_shape(square, .5), dist, reverse = TRUE, cols = c(rbind(cols1, cols2, cols3, cols4)) ) paradox(scale_shape(square, .5, c(0.5, 0)), dist, reverse = FALSE, cols = c(rbind(cols3, cols4, cols1, cols2)) ) paradox(scale_shape(square, .5, .5), dist, reverse = FALSE, cols = c(rbind(cols1, cols2, cols3, cols4)) ) paradox(scale_shape(square, .5, c(0, 0.5)), dist, reverse = TRUE, cols = c(rbind(cols3, cols4, cols1, cols2)) ) }
if (interactive()) { triangle <- cbind(x = c(0, 1, .7), y = c(0, 0.1, 1)) triangle2 <- cbind(x = c(0, 0, .7), y = c(0, 1, 1)) square <- cbind(x = c(0, 1, 1, 0), y = c(0, 0, 1, 1)) canvas() paradox(square, 0.03) canvas() paradox(triangle, 0.042) paradox(triangle2, 0.042) canvas() paradox(scale_shape(square, c(0.5, 1)), 0.03) paradox(scale_shape(square, c(0.5, 1), c(0.5, 0)), 0.05, reverse = TRUE) canvas() dist <- 0.02 paradox(scale_shape(square, .5), dist) paradox(scale_shape(square, .5, c(0.5, 0)), dist, reverse = TRUE) paradox(scale_shape(square, .5, .5), dist) paradox(scale_shape(square, .5, c(0, 0.5)), dist, reverse = TRUE) canvas() dist <- 0.02 paradox(scale_shape(square, .5), dist, reverse = TRUE) paradox(scale_shape(square, .5, c(0.5, 0)), dist, reverse = TRUE) paradox(scale_shape(square, .5, .5), dist, reverse = TRUE) paradox(scale_shape(square, .5, c(0, 0.5)), dist, reverse = TRUE) canvas() dist <- 0.02 cols1 <- colorRampPalette(c("red", "blue"))(30) cols2 <- colorRampPalette(c("blue", "red"))(30) cols3 <- colorRampPalette(c("green", "purple"))(30) cols4 <- colorRampPalette(c("purple", "green"))(30) paradox(scale_shape(square, .5), dist, reverse = TRUE, cols = c(rbind(cols1, cols2, cols3, cols4)) ) paradox(scale_shape(square, .5, c(0.5, 0)), dist, reverse = FALSE, cols = c(rbind(cols3, cols4, cols1, cols2)) ) paradox(scale_shape(square, .5, .5), dist, reverse = FALSE, cols = c(rbind(cols1, cols2, cols3, cols4)) ) paradox(scale_shape(square, .5, c(0, 0.5)), dist, reverse = TRUE, cols = c(rbind(cols3, cols4, cols1, cols2)) ) }
FUNCTION_DESCRIPTION
git_init(path = ".", commit = TRUE)
git_init(path = ".", commit = TRUE)
path |
PARAM_DESCRIPTION, Default: '.' |
commit |
PARAM_DESCRIPTION, Default: TRUE |
DETAILS
no return value
if (interactive()) { # initialise a git repository and stage all files git_init(commit = FALSE) }
if (interactive()) { # initialise a git repository and stage all files git_init(commit = FALSE) }
FUNCTION_DESCRIPTION
installed_packages()
installed_packages()
DETAILS
OUTPUT_DESCRIPTION
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
FUNCTION_DESCRIPTION
open_dir(dir = ".")
open_dir(dir = ".")
dir |
PARAM_DESCRIPTION, Default: '.' |
DETAILS
OUTPUT_DESCRIPTION
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
FUNCTION_DESCRIPTION
quick_help(person, project, path = getOption("cpmtools.quick_help_path"))
quick_help(person, project, path = getOption("cpmtools.quick_help_path"))
person |
PARAM_DESCRIPTION |
project |
PARAM_DESCRIPTION |
path |
PARAM_DESCRIPTION, Default: getOption("cpmtools.quick_help_path") |
DETAILS
OUTPUT_DESCRIPTION
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
FUNCTION_DESCRIPTION
sourceTAF2(script, quiet = FALSE)
sourceTAF2(script, quiet = FALSE)
script |
PARAM_DESCRIPTION |
quiet |
PARAM_DESCRIPTION, Default: FALSE |
DETAILS
OUTPUT_DESCRIPTION
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
FUNCTION_DESCRIPTION
taf_gitignore(path = ".", append = FALSE)
taf_gitignore(path = ".", append = FALSE)
path |
PARAM_DESCRIPTION, Default: '.' |
append |
PARAM_DESCRIPTION, Default: FALSE |
DETAILS
OUTPUT_DESCRIPTION
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
description
taf_roxy(dataset)
taf_roxy(dataset)
dataset |
the name of the dataset that will be created |
DETAILS
OUTPUT_DESCRIPTION
## Not run: if (interactive()) { # EXAMPLE1 } ## End(Not run)
## Not run: if (interactive()) { # EXAMPLE1 } ## End(Not run)
FUNCTION_DESCRIPTION
update_r_win(check.only = TRUE)
update_r_win(check.only = TRUE)
check.only |
if TRUE R binaries are not downloaded and installed, only a check is performed |
OUTPUT_DESCRIPTION
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
Write a SAM assessment to a json file int the correct format to be uploaded to the TAF assessment results database
write_sam_upload(fit, dir = NULL)
write_sam_upload(fit, dir = NULL)
fit |
a fitted object from a SAM model fit. |
dir |
an optional directory name. |
FUNCTION_DESCRIPTION
write.taf.json(x, file = NULL, dir = NULL, ...)
write.taf.json(x, file = NULL, dir = NULL, ...)
x |
PARAM_DESCRIPTION |
file |
PARAM_DESCRIPTION, Default: NULL |
dir |
PARAM_DESCRIPTION, Default: NULL |
... |
PARAM_DESCRIPTION |
DETAILS
no return value