uary 14, 2015 at 8:47 AM
To: dh m mailto:macque...@llnl.gov>>
Cc: Mark Leeds mailto:marklee...@gmail.com>>,
"r-help-stat.math.ethz.ch"
mailto:r-h...@stat.math.ethz.ch>>
Subject: Re: [R] regular expression question
On Wed, Jan 14, 2015 at 10:03 AM, MacQueen, Don
m
On Wed, Jan 14, 2015 at 10:03 AM, MacQueen, Don wrote:
> I know you already have a couple of solutions, but I would like to mention
> that it can be done in two steps with very simple regular expressions. I
> would have done:
>
> s <- c("lngimbintrhofixed","lngimbnointnorhofixed","test",
>
I know you already have a couple of solutions, but I would like to mention
that it can be done in two steps with very simple regular expressions. I
would have done:
s <- c("lngimbintrhofixed","lngimbnointnorhofixed","test",
'rhofixedtest','norhofixedtest')
res <- gsub('norhofixed$', '',s)
r
Hi Mark,
Mark Leeds writes:
> Hi All: I have a regular expression problem. If a character string ends
> with "rhofixed" or "norhofixed", I want that part of the string to be
> removed. If it doesn't end with either of those two endings, then the
> result should be the same as the original. Below
No HTML please. it makes me itchy!
> s <- c("lngimbintrhofixed","lngimbnointnorhofixed","test")
> sub('(no)?rhofixed$','',s)
[1] "lngimbint" "lngimbnoint" "test"
>
On Mon, Jan 12, 2015 at 1:37 PM, Mark Leeds wrote:
> Hi All: I have a regular expression problem. If a character string ends
>
Hi All: I have a regular expression problem. If a character string ends
with "rhofixed" or "norhofixed", I want that part of the string to be
removed. If it doesn't end with either of those two endings, then the
result should be the same as the original. Below doesn't work for the
second case. I kn
Hi Erin,
Please read ?grep. It is clearly not the function you want (neither
is strsplit() either really). This does what you want and you can
modify for upper/lower case if you need it. Also note that regular
expressions exist separate from R, so while ":" may have seemed
natural to select a r
On Mon, Apr 11, 2011 at 10:49 PM, Erin Hodgess wrote:
> Dear R People:
>
> I have a data frame with the following column names:
>
>> names(funky)
> [1] "UHD.1" "UHD.2" "UHD.3" "UHD.4" "L..W..1" "L..W..2" "L..W..3"
> [8] "L..W..4" "B..W..1" "B..W..2" "B..W..3" "B..W..4" "W..B..1" "W..B..2
Dear R People:
I have a data frame with the following column names:
> names(funky)
[1] "UHD.1" "UHD.2" "UHD.3" "UHD.4" "L..W..1" "L..W..2" "L..W..3"
[8] "L..W..4" "B..W..1" "B..W..2" "B..W..3" "B..W..4" "W..B..1" "W..B..2"
[15] "W..B..3" "W..B..4" "B..G..1" "B..G..2" "B..G..3" "B..G..4"
Greg Snow wrote:
> Here is another approach that still uses strspit if you want to stay with
> that:
>
>
>> tmp <- '(-0.791,-0.263].(-38,-1.24].(0.96,2.43]'
>> strsplit(tmp, '\\.(?=\\()', perl=TRUE)
>>
> [[1]]
> [1] "(-0.791,-0.263]" "(-38,-1.24]" "(0.96,2.43]"
>
> This uses the Per
8.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of markle...@verizon.net
> Sent: Monday, March 02, 2009 11:17 PM
> To: r-help@r-project.org
> Subject: [R] regular expression question
>
>
Here are two solutions using gsubfn package.
strapply works by matching the what you want
rather than what you don't want which may make
it easier in this case. The two solutions are the
same except we use \\ escapes in the first and
[ ... ] in the second, i.e. \\( has the same effect
as [(]. In
Wacek Kusnierczyk wrote:
markle...@verizon.net wrote:
can someone show me how to use a regular expression to break the
string at the bottom up into its three components :
(-0.791,-0.263]
(-38,-1.24]
(0.96,2.43]
I tried to use strplit because of my regexpitis ( it's not curable.
i've been to
markle...@verizon.net wrote:
> can someone show me how to use a regular expression to break the
> string at the bottom up into its three components :
>
> (-0.791,-0.263]
> (-38,-1.24]
> (0.96,2.43]
>
> I tried to use strplit because of my regexpitis ( it's not curable.
> i've been to many doctors a
G'day Mark,
On Tue, 03 Mar 2009 00:16:34 -0600 (CST)
markle...@verizon.net wrote:
> can someone show me how to use a regular expression to break the
> string at the bottom up into its three components :
>
> (-0.791,-0.263]
> (-38,-1.24]
> (0.96,2.43]
>
> I tried to use strplit because of my reg
can someone show me how to use a regular expression to break the string
at the bottom up into its three components :
(-0.791,-0.263]
(-38,-1.24]
(0.96,2.43]
I tried to use strplit because of my regexpitis ( it's not curable. i've
been to many doctors all over NYC. they tell me there's no cure
Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Johannes Hüsing
Sent: Thursday, May 01, 2008 9:45 AM
To: r-help@r-project.org
Subject: Re: [R] regular expression question
[EMAIL PROTECTED] <[EMAIL PROTECTED]> [Thu, May 01, 2008 at
06:27:15PM CEST]:
> I have strings of
[EMAIL PROTECTED] <[EMAIL PROTECTED]> [Thu, May 01, 2008 at 06:27:15PM CEST]:
> I have strings of the form
>
> TICKER.GGG.XX.dat
>
> but GGG is not always three characters so I can't use substr to pull it
> out of the string.
>
> Could someone tell me how to use sub to pull out the GGG
Do
This is probably what you are looking for:
> x <- "TICKER.GGG.XX.dat"
> sub("^.*?\\.([^.]+).*", "\\1", x, perl=TRUE)
[1] "GGG"
> x <- "TICKER.GGGabce.XX.dat"
> sub("^.*?\\.([^.]+).*", "\\1", x, perl=TRUE)
[1] "GGGabce"
On Thu, May 1, 2008 at 12:27 PM, <[EMAIL PROTECTED]> wrote:
> I have
I have strings of the form
TICKER.GGG.XX.dat
but GGG is not always three characters so I can't use substr to pull it
out of the string.
Could someone tell me how to use sub to pull out the GGG but more
generally the string between the dot after the R in TICKER and the next
dot. I still
20 matches
Mail list logo