Right, I see it now. Thanks.
Who knows in another 100 years I may understand regex.
John Kane
Kingston ON Canada
> -Original Message-
> From: smartpink...@yahoo.com
> Sent: Sat, 7 Jul 2012 16:19:54 -0700 (PDT)
> To: jrkrid...@inbox.com
> Subject: Re: [R] Splitting a c
Works perfectly. Thank you very much indeed.
John Kane
Kingston ON Canada
> -Original Message-
> From: dwinsem...@comcast.net
> Sent: Sat, 7 Jul 2012 21:45:58 -0400
> To: jrkrid...@inbox.com
> Subject: Re: [R] Splitting a character vector.
>
>
> On Jul 7, 201
On Jul 7, 2012, at 5:37 PM, John Kane wrote:
I am lousy at simple regex and I have not found a solution to a
simple problem.
I have a vector with some character values that I want to split.
Sample data
dd1 <- c( "XXY (mat harry)","XXY (jim bob)", "CAMP (joe blow)",
"ALP (max jack)")
De
ub(close.par," ",dd1),open.par)
> result
[[1]]
[1] "XXY" "mat harry "
[[2]]
[1] "XXY" "jim bob "
[[3]]
[1] "CAMP" "joe blow "
[[4]]
[1] "ALP" "max jack "
A.K.
- Original Me
: ruipbarra...@sapo.pt
> Sent: Sat, 07 Jul 2012 23:28:26 +0100
> To: jrkrid...@inbox.com
> Subject: Re: [R] Splitting a character vector.
>
> The space is for a different reason, strsplit doesn't put the split
> pattern in the result, so if a space is included it will be
>
;s _exactly_ the same thing.
Rui Barradas
Em 07-07-2012 23:21, John Kane escreveu:
Ah, I think Mark may have it. See my earlier post. Why the space?
John Kane
Kingston ON Canada
-Original Message-
From: ruipbarra...@sapo.pt
Sent: Sat, 07 Jul 2012 23:12:46 +0100
To: marklee...@gmail.
Ah, I think Mark may have it. See my earlier post. Why the space?
John Kane
Kingston ON Canada
> -Original Message-
> From: ruipbarra...@sapo.pt
> Sent: Sat, 07 Jul 2012 23:12:46 +0100
> To: marklee...@gmail.com
> Subject: Re: [R] Splitting a character vector.
>
>
012 23:21:19 +0100
> To: jrkrid...@inbox.com
> Subject: Re: [R] Splitting a character vector.
>
> It's an empty character string, meant to substitute nothing for
> close.par, to get rid of it.
>
> Rui Barradas
>
> Em 07-07-2012 23:17, John Kane escreveu:
>>
ot;, open.par
I probably am just blind but I don't understand what it is doing.
John Kane
Kingston ON Canada
-Original Message-
From: ruipbarra...@sapo.pt
Sent: Sat, 07 Jul 2012 23:08:19 +0100
To: jrkrid...@inbox.com
Subject: Re: [R] Splitting a character vector.
Hello,
Sorry, but I
age-
> From: jdnew...@dcn.davis.ca.us
> Sent: Sat, 07 Jul 2012 15:12:16 -0700
> To: ruipbarra...@sapo.pt, jrkrid...@inbox.com
> Subject: Re: [R] Splitting a character vector.
>
> Just to clarify, the regex engine wants to see a \ before the ( if it is
> to treat it as an ordinary
m: ruipbarra...@sapo.pt
> Sent: Sat, 07 Jul 2012 23:08:19 +0100
> To: jrkrid...@inbox.com
> Subject: Re: [R] Splitting a character vector.
>
> Hello,
>
> Sorry, but I don't understand, you're asking about 4 single quotes, the
> double quotes in open.par are just
the term.
What is it doing?
John Kane
Kingston ON Canada
-Original Message-
From: ruipbarra...@sapo.pt <mailto:ruipbarra...@sapo.pt>
Sent: Sat, 07 Jul 2012 22:55:41 +0100
To: jrkrid...@inbox.com <mai
Just to clarify, the regex engine wants to see a \ before the ( if it is to
treat it as an ordinary character. However, the source code interpreter also
treats \ as an escape character. In order to get a \ into the string, you have
to escape it. So it takes two \ characters in source code to obt
.@sapo.pt
Sent: Sat, 07 Jul 2012 22:55:41 +0100
To: jrkrid...@inbox.com
Subject: Re: [R] Splitting a character vector.
Hello,
Try the following.
open.par <- " \\(" # with a blank before '('
close.par <- "\\)"
result <- strsplit(sub(close.par, ""
n Kane
Kingston ON Canada
> -Original Message-
> From: ruipbarra...@sapo.pt
> Sent: Sat, 07 Jul 2012 22:55:41 +0100
> To: jrkrid...@inbox.com
> Subject: Re: [R] Splitting a character vector.
>
> Hello,
>
> Try the following.
>
> open.par <- " \\("
Hello,
Try the following.
open.par <- " \\(" # with a blank before '('
close.par <- "\\)"
result <- strsplit(sub(close.par, "", dd1), open.par)
Why the two '\\'? Because '(' is a meta-character so it must be escaped.
But '\' is a meta character so it must also be escaped.
Then choose the r
I am lousy at simple regex and I have not found a solution to a simple problem.
I have a vector with some character values that I want to split.
Sample data
dd1 <- c( "XXY (mat harry)","XXY (jim bob)", "CAMP (joe blow)", "ALP (max
jack)")
Desired result
dd2 <- data.frame( xx = c("XXY", "XXY"
17 matches
Mail list logo