Skip to content

Commit

Permalink
version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood authored and cran-robot committed Jul 18, 2018
1 parent 6ee7acf commit 31b205d
Show file tree
Hide file tree
Showing 51 changed files with 2,092 additions and 272 deletions.
23 changes: 12 additions & 11 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: dynutils
Type: Package
Title: Common Functions for the Dynverse Packages
Version: 0.1.0
Title: Common Functionality for the 'dynverse' Packages
Version: 1.0.0
Authors@R: c(
person(
"Robrecht",
Expand All @@ -19,26 +19,27 @@ Authors@R: c(
)
)
Description:
Provides a common functionality for the dynverse packages.
Dynverse is created to support the development, execution, and benchmarking of trajectory inference methods.
For more information, see <https://github.com/dynverse/dynverse>.
Provides common functionality for the 'dynverse' packages.
'dynverse' is created to support the development, execution, and benchmarking of trajectory inference methods.
For more information, check out <https://github.com/dynverse/dynverse>.
License: GPL-3
LazyData: TRUE
RoxygenNote: 6.0.1
Depends: R (>= 3.0.0)
Imports: crayon, devtools, desc, dplyr, glue, magrittr, methods,
processx, purrr, Rcpp, stringr, testthat, tibble, tidyr
Suggests: ggplot2, knitr, readr, rmarkdown
LinkingTo: Rcpp
VignetteBuilder: knitr
Collate: 'RcppExports.R' 'add_class.R' 'inherit_default_params.R'
'calculate_distance.R' 'expand_matrix.R' 'extend_with.R'
'install_packages.R' 'package.R' 'pritt.R'
'random_time_string.R' 'run_until_exit.R' 'scaling.R'
'tibble.R'
'calculate_distance.R' 'check_packages.R' 'expand_matrix.R'
'extend_with.R' 'install_packages.R' 'mapdf.R' 'package.R'
'pritt.R' 'random_time_string.R' 'scaling.R' 'tibble.R'
NeedsCompilation: yes
Packaged: 2018-06-24 12:41:04 UTC; rcannood
Packaged: 2018-07-18 12:41:55 UTC; rcannood
Author: Robrecht Cannoodt [aut, cre] (<https://orcid.org/0000-0003-3641-729X>,
rcannood),
Wouter Saelens [aut] (<https://orcid.org/0000-0002-7114-6248>, zouter)
Maintainer: Robrecht Cannoodt <rcannood@gmail.com>
Repository: CRAN
Date/Publication: 2018-06-24 14:07:55 UTC
Date/Publication: 2018-07-18 13:10:09 UTC
82 changes: 47 additions & 35 deletions MD5
@@ -1,49 +1,61 @@
160299d0627fd1b4937e2e8180938520 *DESCRIPTION
7fd1cd0ad39b2c648625195a33d2a7cb *NAMESPACE
559e9bffb8bf1e8f6fa2bee69eb30f4e *R/RcppExports.R
30b96236f20a33e753cd9e30df10a17d *R/add_class.R
608cf24991008f2856a87421858392aa *DESCRIPTION
8aca8bbc89cc03f8c11d846303914aa7 *NAMESPACE
15b3317475a4dc79ee837baf020b4210 *R/RcppExports.R
6f7fc8ddd74f0326bf2b59a523681cf7 *R/add_class.R
e3850008f88dd058ab181e539a5c50d6 *R/calculate_distance.R
0f487a73cab63061f96224412030a45e *R/expand_matrix.R
9a35a257fed55e02d97c629a50add7ad *R/extend_with.R
1799b09d5fd7efef74826bfc3f941e1b *R/inherit_default_params.R
07154a189a5cb37288feb45a608f9a53 *R/install_packages.R
804c2119fd58eebf877dc70df4c2ef30 *R/package.R
2caaac611f00a3c04d56ea872171f578 *R/pritt.R
28910897cf6c132d3244396d44c3cf29 *R/random_time_string.R
286706fca7f4e4d3fff835a740c429e3 *R/run_until_exit.R
9cb7cbe0086cfb38c03c9873305f1913 *R/scaling.R
550683d4b4e4c47e74ebcf7538ff0f94 *R/tibble.R
8b370792756e494e0cec32034d7b3e8b *README.md
3d00986de3d8d541714a7dd58f3a2ce0 *man/add_class.Rd
d12293c4bf7b1a545afd8a8772ef9160 *R/check_packages.R
ebced609202a59d493b476c3aac3fe8d *R/expand_matrix.R
85c44df9d66d900d3faffeda2bdb4cbf *R/extend_with.R
7b04594ee09c9b479b8ac5bd1863546e *R/inherit_default_params.R
d3bdc879cc8de54ca1297fde2536702b *R/install_packages.R
aaabb9fde3b05e2ed4a51753235b6157 *R/mapdf.R
3255589fcaed67404498fb0983713ab5 *R/package.R
15faad85abe90be3921dcaa156de86bd *R/pritt.R
37bf34c1b1fb077abcc7cb9156a84f38 *R/random_time_string.R
f8dd8af76a7ac011a43271821a80d626 *R/scaling.R
c57520019a9bd779737ce37dbd3e5451 *R/tibble.R
0914edf25fcf8d667015bf5c6d2ec43b *README.md
d4d8b29b95540d27d4550c4896a1d62d *build/vignette.rds
8207888e7b8d50bd61ed53aeaa43c008 *inst/NEWS
552e6e0c1e70efca10b3db1994bc4786 *inst/doc/functionality.R
59e4d8087b619be25f5a83fd1846e261 *inst/doc/functionality.Rmd
d4d77130edd4c4694254a000e806d296 *inst/doc/functionality.html
c3db2b03d9fad3aa6837b3f565dfdebd *man/add_class.Rd
b5ac523861808607b014847cb3797765 *man/apply_minmax_scale.Rd
64174b3e65b65ce84ce3293ae492f994 *man/apply_quantile_scale.Rd
3bef0a231eef2816e0a263a1e4a2242c *man/apply_uniform_scale.Rd
6771faace1ff701049356a61c23bad7e *man/calculate_distance.Rd
bca985c7d6c2e02cd94152865c08f9aa *man/check_packages.Rd
09abf5e13b450bc468bdb12786252548 *man/dynutils.Rd
bdef8b65413518dfe3eb5198f56999cc *man/expand_matrix.Rd
39511ee494f98c86ef0c814408a895f2 *man/extend_with.Rd
5f8774f6b38947d6cd9342c01d6d0d9a *man/extract_row_to_list.Rd
477a87afa99a1d7fab80ad6de6bad480 *man/inherit_default_params.Rd
705111d76df76b2dee7e84ac28436829 *man/install_packages.Rd
cdcecfb50415bd66de2de57fc0859613 *man/list_as_tibble.Rd
78ae11d4f9fd66d62a142b48a0c2d4e7 *man/pritt.Rd
7fdcbd475956fbd310599893c985d802 *man/random_time_string.Rd
e40429d5ea63f5668a626fe44b3158ad *man/run_until_exit.Rd
ab9f5a1c1ab3a0848d9d8aba7b32e7fa *man/scale_minmax.Rd
2d96623cf5d66cd92fb5505d58373356 *man/scale_quantile.Rd
42596f98342158554f6e89171e3a5df2 *man/scale_uniform.Rd
674deaa0bac0516c48694763b0db986b *src/RcppExports.cpp
3252699f0111548d1c5865b259fc6045 *man/check_packages.Rd
413271f77bb57611aeb016fa8f4d5e85 *man/dynutils.Rd
7709555d2461d3fdc0754ff9ed78c279 *man/expand_matrix.Rd
3018e1eb12824f76075b195fe12a4916 *man/extend_with.Rd
9aaed213184b39633d36df275e873813 *man/extract_row_to_list.Rd
740e7a7bf33786b1c8cefcf8ded17610 *man/inherit_default_params.Rd
92547389f18931a8166951634e019577 *man/install_packages.Rd
c75c1e1f49dbefd8590f7424587ad69b *man/list_as_tibble.Rd
aaa833eaa967c4031572cff9760ea88a *man/mapdf.Rd
62bd4790a9a678a2922a0b80a60ed606 *man/pritt.Rd
d030ba9674691137199ba8be588b2986 *man/project_to_segments.Rd
2cf7693dbaf3302c64209d7336c447d5 *man/random_time_string.Rd
3ebf0627b766e627129d9ea56bc4e725 *man/scale_minmax.Rd
796b56abcd3919f503ddecb80735ea9a *man/scale_quantile.Rd
f9110f58085b0ae3ca4bc37b1bec76c9 *man/scale_uniform.Rd
32b3de681b6aeb351f1e91ff7add5e2b *man/tibble_as_list.Rd
69ab276f79857e48416d5cbb4eacd9ed *src/RcppExports.cpp
c44a23e08f260ed4006b531a0eecc561 *src/calculate_distance.cpp
fa89e1f21fd5ca27ac892f4ba8ba9c7c *src/project_to_segments.cpp
645f970b5add7df4c3623df1e9c09778 *tests/testthat.R
90070d56ee12b1460c344b2a4dd11d46 *tests/testthat/test-add_class.R
88e6091b676fd212af7b8092ac5b00a2 *tests/testthat/test-calculate_distance.R
1d3471e3c4f0726a5a3cf2f65a33e807 *tests/testthat/test-calculate_distance.R
dbb99d66a04da64c942eeb3d2aad76a4 *tests/testthat/test-check_packages.R
7485242237d66f602ee1126cbe4000c2 *tests/testthat/test-expand_matrix.R
8faa7d5a28c69f65e45e8ff451fc705b *tests/testthat/test-extend_with.R
5ce31da95e0ab2cae64f31550e6957c1 *tests/testthat/test-inherit_default_params.R
8877b963ff0ac63ef9d85918d715ce49 *tests/testthat/test-install_packages.R
d993460d1ce3623f3edcff631b8f5b9f *tests/testthat/test-install_packages.R
756bcdea5c45ef09d977a958b55c2695 *tests/testthat/test-mapdf.R
d1f8057d6b406af20752b9a0a963107a *tests/testthat/test-pritt.R
12b22a50c13f031e04cafada2045e5eb *tests/testthat/test-project_to_segments.R
15ff28feffad09aff3b062301884d6a4 *tests/testthat/test-random_time_string.R
e74119145832bd5f34f17638ef62070b *tests/testthat/test-run_until_exit.R
bacf3a9c91b28b7ab6ff90784e38ee69 *tests/testthat/test-scaling.R
e8f3614bd73b1b86237c96d5ae9888ac *tests/testthat/test-tibble.R
14eb963310f7d37419f201073a91a6ed *tests/testthat/test-tibble.R
59e4d8087b619be25f5a83fd1846e261 *vignettes/functionality.Rmd
20 changes: 18 additions & 2 deletions NAMESPACE
Expand Up @@ -15,12 +15,21 @@ export(inherit_default_params)
export(install_packages)
export(list_as_tibble)
export(manhattan_distance)
export(mapdf)
export(mapdf_chr)
export(mapdf_dbl)
export(mapdf_dfc)
export(mapdf_dfr)
export(mapdf_int)
export(mapdf_lgl)
export(pritt)
export(project_to_segments)
export(random_time_string)
export(run_until_exit)
export(scale_minmax)
export(scale_quantile)
export(scale_uniform)
export(tibble_as_list)
export(walkdf)
import(dplyr)
import(methods)
import(stringr)
Expand All @@ -35,18 +44,25 @@ importFrom(magrittr,"%<>%")
importFrom(magrittr,set_colnames)
importFrom(magrittr,set_rownames)
importFrom(purrr,"%>%")
importFrom(purrr,as_mapper)
importFrom(purrr,discard)
importFrom(purrr,keep)
importFrom(purrr,map)
importFrom(purrr,map_at)
importFrom(purrr,map_chr)
importFrom(purrr,map_dbl)
importFrom(purrr,map_df)
importFrom(purrr,map_dfc)
importFrom(purrr,map_dfr)
importFrom(purrr,map_if)
importFrom(purrr,map_int)
importFrom(purrr,map_lgl)
importFrom(purrr,set_names)
importFrom(purrr,walk)
importFrom(stats,cor)
importFrom(stats,quantile)
importFrom(stats,setNames)
importFrom(testthat,expect_equal)
importFrom(testthat,expect_false)
importFrom(testthat,expect_is)
importFrom(testthat,expect_named)
importFrom(utils,installed.packages)
Expand Down
28 changes: 28 additions & 0 deletions R/RcppExports.R
Expand Up @@ -9,3 +9,31 @@ euclidean_distance <- function(x, y) {
.Call('_dynutils_euclidean_distance', PACKAGE = 'dynutils', x, y)
}

#' Project a set of points to to set of segments
#'
#' Finds the projection index for a matrix of points \code{x}, when
#' projected onto a set of segments defined by \code{segment_start} and \code{segment_end}.
#'
#' @param x a matrix of data points.
#' @param segment_start a matrix of segment start points.
#' @param segment_end a matrix of segment end points.
#'
#' @return A list with components
#' \item{x_proj}{a matrix of projections of \code{x} onto the given segments.}
#' \item{segment}{the index of the segment a point is projected on}
#' \item{progression}{the progression of a projection along its segment}
#' \item{distance}{the distance from each point in \code{x} to its projection in \code{x_proj}}
#'
#' @examples
#' x <- matrix(rnorm(50, 0, .5), ncol = 2)
#' segfrom <- matrix(c(0, 1, 0, -1, 1, 0, -1, 0), ncol = 2, byrow = TRUE)
#' segto <- segfrom / 10
#' fit <- project_to_segments(x, segfrom, segto)
#'
#' str(fit) # examine output
#'
#' @export
project_to_segments <- function(x, segment_start, segment_end) {
.Call('_dynutils_project_to_segments', PACKAGE = 'dynutils', x, segment_start, segment_end)
}

4 changes: 4 additions & 0 deletions R/add_class.R
Expand Up @@ -4,6 +4,10 @@
#' @param class A character vector naming classes
#'
#' @export
#'
#' @examples
#' library(purrr)
#' l <- list(important_number = 42) %>% add_class("my_list")
add_class <- function(x, class) {
class(x) <- c(class, class(x))
x
Expand Down
16 changes: 16 additions & 0 deletions R/check_packages.R
@@ -0,0 +1,16 @@
#' Check which packages are installed
#'
#' @param ... A set of package names
#'
#' @export
#'
#' @importFrom utils installed.packages
#'
#' @examples
#' check_packages("SCORPIUS", "dynutils")
#' check_packages(c("princurve", "mlr", "tidyverse"))
check_packages <- function(...) {
packages <- unlist(list(...))
installed_packages <- rownames(utils::installed.packages())
set_names(packages %in% installed_packages, packages)
}
4 changes: 4 additions & 0 deletions R/expand_matrix.R
Expand Up @@ -6,6 +6,10 @@
#' @param fill With what to fill missing data
#'
#' @export
#'
#' @examples
#' x <- matrix(runif(12), ncol = 4, dimnames = list(c("a", "c", "d"), c("D", "F", "H", "I")))
#' expand_matrix(x, letters[1:5], LETTERS[1:10], fill = 0)
expand_matrix <- function(
mat,
rownames = NULL,
Expand Down
11 changes: 10 additions & 1 deletion R/extend_with.R
Expand Up @@ -4,9 +4,18 @@
#' @param .class_name A class name to add
#' @param ... Extra information in the list
#'
#' @importFrom testthat expect_is expect_named
#' @importFrom testthat expect_is expect_named expect_false
#'
#' @export
#'
#' @examples
#' library(purrr)
#' l <- list(important_number = 42) %>% add_class("my_list")
#' l %>% extend_with(
#' .class_name = "improved_list",
#' url = "https://github.com/dynverse/dynverse"
#' )
#' l
extend_with <- function(
object,
.class_name,
Expand Down
16 changes: 4 additions & 12 deletions R/inherit_default_params.R
Expand Up @@ -7,25 +7,17 @@
#' @export
#'
#' @examples
#' fun1 <- function(a = 10, b = 7) {
#' runif(a, -b, b)
#' }
#'
#' fun2 <- function(c = 9) {
#' 2^c
#' }
#' fun1 <- function(a = 10, b = 7) runif(a, -b, b)
#' fun2 <- function(c = 9) 2^c
#'
#' fun3 <- inherit_default_params(
#' super = list(fun1, fun2),
#' fun = function(a, b, c) {
#' x <- fun1(a, b)
#' y <- fun2(c)
#' list(x = x, y = y)
#' list(x = fun1(a, b), y = fun2(c))
#' }
#' )
#'
#' fun3(1, 2, 3)
#' fun3()
#' fun3
inherit_default_params <- function(super_functions, fun) {
if (is.function(super_functions)) {
super_functions <- list(super_functions)
Expand Down

0 comments on commit 31b205d

Please sign in to comment.