Closed sgibb closed 2 years ago
countElements
returns now alist
(ofinteger
?) because multiple input formulas are supported, right? If that's the case I would be OK with this incompatible change.
Correct. A list
of named integer
s.
- regarding the
y
parameter inaddElements
: ify
is of length 1 (e.g.y = "H"
) this will be added to each formula inx
, right? And it would be possible to add/substract a different formula from eachx
?
Correct. If multiple x
and a single y
are given, y
is add/subtract from each x
. If a single x
and multiple y
are given, the x
is recycled/duplicated and each y
is add/substract to x
. Before multiple y
are cumulative added/subtracted to/from a single x
. For multiple x
and multiple y
(given the same length), each x
is added/subtracted to/from each corresponding y
.
This PR is meant for discussion. It changes the behaviour of
countElements
, especially its input and output values. So it is a backward incompatible change:countElements
accepts now a vector as input but returns alist
instead of aninteger
.y
argument inaddElements
/substractElement
changed. Before it was added/subtracted in a cumulative manner. Now eitherx
ory
is recycled to have the same length. (If required we could restore the old behaviour but this would make vectorization of the arguments hard to understand.)stringr
is dropped.While dropping
stringr
I rewrotecountElements
usinggregexpr
which yield the same results in nearly half the time:Created on 2021-12-28 by the reprex package (v2.0.1)
EDIT: please be aware that this PR doesn't include the changes from PR #48