David-Hervas / clickR
Showing 1 of 3 files from the diff.
Newly tracked file
R/fix_functions.R changed.
Other files ignored by Codecov
man/fix.levels.Rd has changed.
DESCRIPTION has changed.

@@ -300,7 +300,7 @@
Loading
300 300
#' @param data data.frame with the factor to fix
301 301
#' @param factor_name Name of the factor to fix (as character)
302 302
#' @param method Method from stringdist package to estimate distances
303 -
#' @param levels Optional vector with the levels names
303 +
#' @param levels Optional vector with the levels names. If "auto", levels are assigned based on frequency
304 304
#' @param plot Optional: Plot cluster dendrogram?
305 305
#' @param k Number of levels for clustering
306 306
#' @param track Keep track of changes?
@@ -329,7 +329,7 @@
Loading
329 329
  }
330 330
  groups <- cutree(clusters, k=k)
331 331
  if (!is.null(levels)){
332 -
    if(length(levels) == 1 && levels == "auto") levels <- sapply(split(names(groups), groups), function(x) unique(x)[1])
332 +
    if(length(levels) == 1 && levels == "auto") levels <- sapply(split(names(groups), groups), function(x) names(sort(table(x), decreasing=TRUE))[1])
333 333
    output <- factor(as.vector(groups), levels=1:length(levels), labels=levels[order(apply(sapply(split(as.data.frame(stringdist::stringdistmatrix(tolower(x_na), tolower(levels), method=method, useNames = TRUE, ...)), groups), colMeans), 1, which.min))])
334 334
  } else{
335 335
    output <- groups
Files Coverage
R 0.00%
Project Totals (5 files) 0.00%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading