search for: gusbfn

Displaying 3 results from an estimated 3 matches for "gusbfn".

Did you mean: gsubfn
2023 Mar 07
1
Augment base::replace(x, list, value) to allow list= to be a predicate?
This could be extended to sub and gsub as well which gsubfn in the gusbfn package already does: library(gsubfn) gsubfn("^..", toupper, c("abc", "xyz")) ## [1] "ABc" "XYz" On Fri, Mar 3, 2023 at 7:22?PM Pavel Krivitsky <p.krivitsky at unsw.edu.au> wrote: > > Dear All, > > Currently, list= in base:...
2023 Mar 08
1
Augment base::replace(x, list, value) to allow list= to be a predicate?
...But this isn't a simple change to replace() anymore, and I may just be spending too much time tinkering with Julia. Steve On Tue, 7 Mar 2023 at 07:34, Gabor Grothendieck <ggrothendieck at gmail.com> wrote: > > This could be extended to sub and gsub as well which gsubfn in the > gusbfn package already does: > > library(gsubfn) > gsubfn("^..", toupper, c("abc", "xyz")) > ## [1] "ABc" "XYz" > > On Fri, Mar 3, 2023 at 7:22?PM Pavel Krivitsky <p.krivitsky at unsw.edu.au> wrote: > > > > Dear Al...
2023 Mar 04
3
Augment base::replace(x, list, value) to allow list= to be a predicate?
Dear All, Currently, list= in base::replace(x, list, value) has to be an index vector. For me, at least, the most common use case is for list= to be some simple property of elements of x, e.g., x <- c(1,2,NA,3) replace(x, is.na(x), 0) Particularly when using R pipes, which don't allow multiple substitutions, it would simplify many of such cases if list= could be a function that returns