Skip to content

Commit

Permalink
Remove pre-computed results from a vignettes folder. Add checks for t…
Browse files Browse the repository at this point in the history
…ype of objects to segmentPattern()
  • Loading branch information
Marta Karas committed Mar 17, 2019
1 parent 28afed4 commit 2033732
Show file tree
Hide file tree
Showing 22 changed files with 969 additions and 1,398,568 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
@@ -1,3 +1,5 @@
^Meta$
^doc$
^docs$
^_pkgdown\.yml$
^.*\.Rproj$
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,3 +1,5 @@
Meta
doc
.Rproj.user
.Rhistory
.RData
Expand Down
21 changes: 21 additions & 0 deletions R/segmentPattern.R
Expand Up @@ -226,6 +226,27 @@ segmentPattern <- function(x,
x.cut.vl = 6000,
compute.template.idx = FALSE){


## Check if correct objects were passed to the function
x.cut.vl <- as.integer(x.cut.vl)
if(!is.null(run.parallel.cores)) run.parallel.cores <- as.integer(run.parallel.cores)
if (!(all(is.numeric(x)) & is.atomic(x))) stop("x must be a numeric (atomic) vector.")
if (!(length(x.fs) == 1 & is.numeric(x.fs) & x.fs > 0 & is.atomic(x.fs))) stop("x.fs must be a positive numeric scalar.")
template.cond1 <- all(is.numeric(template)) & is.atomic(template)
template.cond2 <- is.list(template) & all(sapply(template, function(vec) all(is.numeric(vec)) & is.atomic(vec)))
if (!(template.cond1 || template.cond2)) stop("template must be a numeric (atomic) vector, or a list of numeric (atomic) vectors.")
if (!(all(is.numeric(pattern.dur.seq)) & is.atomic(pattern.dur.seq) & all(pattern.dur.seq > 0))) stop("x must be a numeric (atomic) vector of positive values.")
if (!(similarity.measure %in% c("cov", "cor"))) stop("similarity.measure must be one of: 'cov', 'cor'.")
if (!(is.null(x.adept.ma.W) || (length(x.adept.ma.W) == 1 & is.numeric(x.adept.ma.W) & x.adept.ma.W > 0))) stop("x.adept.ma.W must be NULL or a positive numeric scalar.")
if (!(is.null(finetune) || finetune == "maxima")) stop("finetune must be NULL or 'maxima'.")
if (!(is.null(finetune.maxima.ma.W) || (length(finetune.maxima.ma.W) == 1 & is.numeric(finetune.maxima.ma.W) & finetune.maxima.ma.W > 0))) stop("finetune.maxima.ma.W must be NULL or a positive numeric scalar.")
if (!(is.null(finetune.maxima.nbh.W) || (length(finetune.maxima.nbh.W) == 1 & is.numeric(finetune.maxima.nbh.W) & finetune.maxima.nbh.W > 0))) stop("finetune.maxima.nbh.W must be NULL or a positive numeric scalar.")
if (!(run.parallel %in% c(TRUE, FALSE))) stop("run.parallel must be a logical scalar.")
if (!(is.null(run.parallel.cores) || (length(run.parallel.cores) == 1 & is.integer(run.parallel.cores) & run.parallel.cores > 0))) stop("run.parallel.cores must me NULL or a positive integer scalar")
if (!(length(x.cut) == 1 & x.cut %in% c(TRUE, FALSE))) stop("x.cut must be a logical scalar.")
if (!(is.null(x.cut.vl) || (length(x.cut.vl) == 1 & is.integer(x.cut.vl) & x.cut.vl > 0))) stop("x.cut.vl must me NULL or a positive integer scalar")
if (!(length(compute.template.idx) == 1 & compute.template.idx %in% c(TRUE, FALSE))) stop("compute.template.idx must be a logical scalar.")

## ---------------------------------------------------------------------------
## Compute a list of rescaled template(s)

Expand Down
942 changes: 471 additions & 471 deletions docs/articles/adept-intro.html

Large diffs are not rendered by default.

905 changes: 455 additions & 450 deletions docs/articles/adept-strides-segmentation.html

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 13 additions & 16 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
@@ -1,4 +1,4 @@
pandoc: 1.19.2.1
pandoc: 2.7.1
pkgdown: 1.3.0
pkgdown_sha: ~
articles:
Expand Down
7 changes: 4 additions & 3 deletions vignettes/adept-strides-segmentation.Rmd
Expand Up @@ -21,8 +21,8 @@ knitr::opts_chunk$set(
global.par = TRUE
)
## Label to whether or not run code from local
run_local = TRUE
print(getwd())
run_local = FALSE
# print(getwd())
# wd.tmp <- "/Users/martakaras/Dropbox/_PROJECTS/R/adept/vignettes/"
# run_local = FALSE
```
Expand Down Expand Up @@ -534,11 +534,12 @@ data.mat <- as.matrix(stride_S.dfdc.la)
D.mat <- dist(cor(data.mat))
## Get cluster medoids
cluster.k <- 3
cluster.k <- 2
medoids.idx <- round(seq(1, ncol(stride_S.dfdc.la), length.out = cluster.k + 2))
medoids.idx <- medoids.idx[-c(1, medoids.idx + 2)]
## Cluster strides
set.seed(1)
pam.out <- cluster::pam(D.mat, cluster.k, diss = TRUE, medoids = medoids.idx)
table(pam.out$clustering)
Expand Down

0 comments on commit 2033732

Please sign in to comment.