Skip to content

Commit

Permalink
Merge branch 'feat@parallel' of github.com:tanaylab/tglkmeans into fe…
Browse files Browse the repository at this point in the history
…at@parallel
  • Loading branch information
aviezerl committed Dec 26, 2023
2 parents 22b7340 + 560a805 commit 5ee7f02
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 9 deletions.
6 changes: 3 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

* Added validity checks for `k` and the number of observations.

# tgkmeans 0.3.11
# tglkmeans 0.3.11

* Changed pkgdoc, see: https://github.com/r-lib/roxygen2/issues/1491.

# tgkmeans 0.3.10
# tglkmeans 0.3.10

* Removed broken link to one of the references in the description.

# tgkmeans 0.3.9
# tglkmeans 0.3.9

* Remove empty clusters. This may happen when the number of clusters is larger than the number of observations, and currently caused an error in the reordering step.

Expand Down
9 changes: 9 additions & 0 deletions R/TGL_kmeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ TGL_kmeans_tidy <- function(df,

mat <- df

# make sure that the input is numeric
mat <- as.matrix(mat)
if (!is.numeric(mat)) {
if (any(!is.numeric(mat[, 1])) && missing(id_column) && !id_column) {
cli_abort("{.field df} must be numeric. Note that the default of {.field id_column} was changed to FALSE in version {.field 0.4.0}. If you want to use the first column as ids, please set {.field id_column=TRUE}")
}
cli_abort("{.field df} must be numeric.")
}

if (k < 1) {
cli_abort("k must be greater than 0")
}
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ browseVignettes("usage")

## A note regarding random number generation

From version 0.4.0 onwards, the package uses R random number generation functions instead of the C++11 random number generation functions. Note that this may result in different results from previous versions. To get the same results as previous versions, set the `use_cpp_random` argument to `TRUE` in the `TGL_kmeans` function.
From version 0.4.0 onward, the package uses R random number generation functions instead of the C++11 random number generation functions. Note that this may result in different results from previous versions. To get the same results as previous versions, set the `use_cpp_random` argument to `TRUE` in the `TGL_kmeans` function.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ browseVignettes("usage")

## A note regarding random number generation

From version 0.4.0 onwards, the package uses R random number generation
From version 0.4.0 onward, the package uses R random number generation
functions instead of the C++11 random number generation functions. Note
that this may result in different results from previous versions. To get
the same results as previous versions, set the `use_cpp_random` argument
Expand Down
2 changes: 1 addition & 1 deletion man/TGL_kmeans.Rd

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

2 changes: 1 addition & 1 deletion man/TGL_kmeans_tidy.Rd

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

4 changes: 2 additions & 2 deletions src/AParamStat.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ float wilcoxon_rank_sum(list <T> &samples, int type = 1) {
float EU = n1 * n2 / 2.0;
float VarU = n1 * n2 * (samples.size() + 1) / 12.0;

Rcpp::Rcout << "W " << W << " n2 " << n2 << " EU " << EU << " Var " << VarU << endl;
Rcpp::Rcout << "W " << W << " n2 " << n2 << " EU " << EU << " Var " << VarU << " t2_minus_t " << t3_minus_t << endl;

float pv = erfc((U - EU) / sqrt(VarU));

Expand Down Expand Up @@ -124,7 +124,7 @@ float siegel_tukey(list <T> &samples, int type = 1) {
float EU = n1 * n2 / 2.0;
float VarU = n1 * n2 * (samples.size() + 1) / 12.0;

Rcpp::Rcout << "W " << W << " n2 " << n2 << " EU " << EU << " Var " << VarU << endl;
Rcpp::Rcout << "W " << W << " n2 " << n2 << " EU " << EU << " Var " << VarU << " t2_minus_t " << t3_minus_t << endl;
float pv = erfc((U - EU) / sqrt(VarU));

return (pv);
Expand Down
1 change: 1 addition & 0 deletions vignettes/usage.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ library(dplyr)
library(ggplot2)
library(tglkmeans)
theme_set(theme_classic())
set.seed(60427)
```

First, let's create 5 clusters normally distributed around 1 to 5, with sd of 0.3:
Expand Down

0 comments on commit 5ee7f02

Please sign in to comment.