similar to: New package gsubfn

Displaying 20 results from an estimated 10000 matches similar to: "New package gsubfn"

2013 Dec 17
3
In-string variable/symbol substitution: What formats/syntax is out there?
Hi, I'm try to collect a list of methods/packages available in R for doing in-string variable/symbol substitution, e.g. someFcn("pi=${pi}"), anotherFcn("pi=@pi@") and so on becomes "pi=3.141593". I am aware of the following: ** gsubfn() in the 'gsubfn' package, e.g. > gsubfn( , , "pi = $pi, 2pi = `2*pi`") [1] "pi = 3.14159265358979,
2008 Oct 20
0
New verion 0.3-7 of gsubfn package
Version 0.3-7 of the gsubfn package is available on CRAN. Changes to the package are: - all known bugs have been fixed. - in gsubfn and strapply the replacement object can be a list (or a function, formula, character string or proto object, as before). In the case of a list, regexp matches are looked up in the list names and the corresponding list component used. # Example 1 - at
2008 Oct 20
0
New verion 0.3-7 of gsubfn package
Version 0.3-7 of the gsubfn package is available on CRAN. Changes to the package are: - all known bugs have been fixed. - in gsubfn and strapply the replacement object can be a list (or a function, formula, character string or proto object, as before). In the case of a list, regexp matches are looked up in the list names and the corresponding list component used. # Example 1 - at
2008 Oct 28
1
gsubfn, strapply, REGEX Problem
Hi all, I swear this used to work: library(gsubfn) strapply("S(AC,P)TVDK(8)EELVQK(8), ".[(].{1,2}[)]|.")[[1]] But somewhere along the update path it stopped ... now giving me this Error in base::gsub(pattern, rs, x, ...) : invalid backreference 2 in regular expression Can't figure it out. What am I doing wrong? Thanks for any hints, Joh
2007 Mar 08
2
Named backreferences in replacement patterns
Hi I have a problem with substitutions involving named backreferences. I have a vector American.dates: > American.dates [1] "5/15/1976" "2.15.1970" "1.9.2006" which I want to change into British.dates: > British.dates [1] "15/5/1976" "15/2/1970" "9/1/2006" I know I can do it like this:
2009 Oct 03
1
Named backreference in gsub()?
Hi, I'm running out of the *numbered* backreferences \\1, \\2, ..., \\9 for gsub(). Does R support *named* backreferences, and if so, what is the syntax? Thanks Henrik
2023 Mar 08
1
Augment base::replace(x, list, value) to allow list= to be a predicate?
That's an interesting example, as it's conceptually similar to what Pavel is proposing, but structurally different. gsubfn() is more complicated than a simple switch in the body of the function, and wouldn't work well as an anonymous function. Multiple dispatch can nicely encompass both of these cases. For replace(), library(S7) replace <- new_generic("replace",
2012 Nov 02
2
backreferences in gregexpr
Hi Folks, I'm trying to extract just the backreferences from a regex. > temp = "abcd1234abcd1234" > regmatches(temp, gregexpr("(?:abcd)(1234)", temp)) [[1]] [1] "abcd1234" "abcd1234" What I would like is: [1] "1234" "1234" Note: I know I can just match 1234 here, but the actual example is complicated enough that I have to
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::replace(x, list, value)
2018 Feb 13
1
Help with regular expressions
You can either use positive lookahead/lookbehind - but support for that is a bit flaky. Or write a proper regex, and use backreferences to keep what you need. R > x <- "abc 1,1 ,1 1, x,y 2,3 " R > gsub("(\\d),(\\d)", "\\1.\\2", x, perl = TRUE) [1] "abc 1.1 ,1 1, x,y 2.3 " B. > On Feb 12, 2018, at 9:34 PM, Jim Lemon <drjimlemon at
2013 Apr 15
6
how to transform string to "Camel Case"?
Dear all, Given the following vector: > (z <- c('R project', 'hello world', 'something Else')) [1] "R project" "hello world" "something Else" I know how to obtain all capitals or all lower case letters: > tolower(z) [1] "r project" "hello world" "something else" > toupper(z) [1] "R
2012 Sep 14
1
please comment on my function
this function is supposed to canonicalize the language: --8<---------------cut here---------------start------------->8--- canonicalize.language <- function (s) { s <- tolower(s) long <- nchar(s) == 5 s[long] <- sub("^([a-z]{2})[-_][a-z]{2}$","\\1",s[long]) s[nchar(s) != 2 & s != "c"] <- "unknown" s }
2010 Dec 16
0
R 2.12.1 is released
I've rolled up R-2.12.1.tar.gz a short while ago. This is an update release, which fixes a number of mostly minor issues, and some consolidation within the area of reference classes. The most serious issues were probably that we were not catching misspelled NAMESPACE directives and not catching accidentally unnamed switch() arguments (notice that fixing either will likely uncover errors in
2010 Dec 16
0
R 2.12.1 is released
I've rolled up R-2.12.1.tar.gz a short while ago. This is an update release, which fixes a number of mostly minor issues, and some consolidation within the area of reference classes. The most serious issues were probably that we were not catching misspelled NAMESPACE directives and not catching accidentally unnamed switch() arguments (notice that fixing either will likely uncover errors in
2006 Jun 04
1
Fwd: Re: How to call a value labels attribute?
How is what you are doing any different from factors? > x <- factor(c(1, 2, 3, 3, 2, 3, 1), labels=c("apple", "banana", "other")) > x [1] apple banana other other banana other apple Levels: apple banana other > as.numeric(x) [1] 1 2 3 3 2 3 1 > levels(x)[3] <- "birne" > x [1] apple banana birne birne banana birne apple
2008 Aug 06
2
matching problem
I have a matching problem that I cant solve. mystring = "xxx{XX}yy{YYY}zzz{Z}" where "x","X","y","Y","z","Z" basiclly can be anything, letters, digits etc. I'm only interested in the content within each "{}". I am close but not really there yet. library(gsubfn) strapply(mystring,"\\{[^\\}]+",, perl=F)
2012 Apr 26
2
Using backreferences from node name regex match
I appears that backreferences when using regexes in node names doesn''t work. Can anyone confirm this? If I''m incorrect, how do I go about using a backreference to the name regex within the node definition container? Thanks, Guy -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web
2012 Oct 22
4
¿Problemas al cargar slqdf sobre Windows....?
Hola, Estoy intentando cargar la librería "sqldf" y obtengo este error: > library(sqldf) Loading required package: gsubfn Error : .onLoad failed in loadNamespace() for ''gsubfn'', details: call: get(name, envir = asNamespace(pkg), inherits = FALSE) error: objeto ''addVigs2WinMenu'' no encontrado Error: package ‘gsubfn’ could not be loaded La
2009 Dec 01
2
Cut intervals (character) to numeric midpoint; regex problem
Starting with the head of a 499 element matrix whose column names are now the labels trom a cut() operation, I needed to get to a vector of midpoints to serve as the basis for plotting a calibration curve ( exp(linear predictor) vs. : > dput(head(dimnames(mtcal)[2][[1]])) # was starting point testvec <- c("(-8.616,-3.084]", "(-3.084,-2.876]",
2020 Jun 15
1
Voice "broken" during calls
On Monday 15 June 2020 at 21:50:36, Luca Bertoncello wrote: > Am 15.06.2020 um 21:28 schrieb Antony Stone: > > On Monday 15 June 2020 at 21:19:51, Luca Bertoncello wrote: > >> But I'm not really sure, that Asterisk could be the problem, since, as I > >> said, the problem happens even if I connect the phone direct to the > >> server of Telekom... > >