diff --git a/DESCRIPTION b/DESCRIPTION index 722009686afb072bbf7aae91e6f632561776d13a..9608873d2fbf56e8de2ec253a9481ced579d8497 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -10,8 +10,6 @@ Description: Collection of time series analysis tools, focused on spectral decom License: MIT licence LazyLoad: yes RoxygenNote: 7.3.2 -Imports: Rdpack, sfsmisc, cmna, gsignal, pracma +Imports: Rdpack, sfsmisc, cmna, gsignal, pracma, RcppAlgos RdMacros: Rdpack -Depends: - R (>= 2.10) LazyData: true diff --git a/R/toneCombinations.R b/R/toneCombinations.R index 34ac0e7343f6a7cb8386839836c9bf1c4684bc40..3fb33c86113a488763286cc71f0fb254a7ba0167 100644 --- a/R/toneCombinations.R +++ b/R/toneCombinations.R @@ -94,9 +94,11 @@ generate_name <- function(invec,char="s", labels = NULL){ #' @param infreq : input frequencies #' @param omegas : reference frequencies (a numeric vector which may contain explicit row names) #' @param fractions : 1, 2, or 3 depending on willing to include singe, double or triple periods +#' @param keepPositives : argument passed to `toneCombinations` #' @param tol1 : acceptable tolerance for being considered as a certain attribution #' (if several frequencies match the criteria, the closest will be taken) #' @param tol2 : acceptable tolerance for being considered as a likely or plausible +#' @seealso toneCombinations #' @export attributeTones #' #' @examples @@ -112,9 +114,9 @@ generate_name <- function(invec,char="s", labels = NULL){ #' plot(outfreqs, outamps, type='h') #' text(outfreqs, outamps+0.1, attributions) #' -attributeTones <- function(infreq , omegas, fractions=1, tol1 = 1.e-6, tol2 = 1.e-4) { +attributeTones <- function(infreq , omegas, fractions=1, tol1 = 1.e-6, tol2 = 1.e-4, keepPositives=TRUE) { attributions <- rep("", length(infreq)) - combis <- toneCombinations(omegas, fractions=fractions) + combis <- toneCombinations(omegas, fractions=fractions, keepPositives) for (i in seq(infreq)){ deltas <- abs(infreq[i] - combis) bestSuspect <- which.min(abs(infreq[i] - combis)) diff --git a/man/attributeTones.Rd b/man/attributeTones.Rd index 0d962e072a2b5591bd8d2f3148bb555228b3a241..479ab77eb290f0fc1d42d4d34be867adb248c74a 100644 --- a/man/attributeTones.Rd +++ b/man/attributeTones.Rd @@ -4,7 +4,14 @@ \alias{attributeTones} \title{Attribution of combination of tones} \usage{ -attributeTones(infreq, omegas, fractions = 1, tol1 = 1e-06, tol2 = 1e-04) +attributeTones( + infreq, + omegas, + fractions = 1, + tol1 = 1e-06, + tol2 = 1e-04, + keepPositives = TRUE +) } \arguments{ \item{infreq}{: input frequencies} @@ -17,6 +24,8 @@ attributeTones(infreq, omegas, fractions = 1, tol1 = 1e-06, tol2 = 1e-04) (if several frequencies match the criteria, the closest will be taken)} \item{tol2}{: acceptable tolerance for being considered as a likely or plausible} + +\item{keepPositives}{: argument passed to `toneCombinations`} } \description{ Based on a vector of frequencies (`infreq`), and a vector of referenc @@ -37,3 +46,6 @@ plot(outfreqs, outamps, type='h') text(outfreqs, outamps+0.1, attributions) } +\seealso{ +toneCombinations +}