Hi together,
I found a solution to my problem that works for me and performs
reasonable well in my opinion. Instead of looping through both
datasets, I decided to replicate each row in d2 from Min_Month to
Max_Month and then use the match-function. Here is the code (I changed
the original example
Hello R-Community,
I have the following matching problem: I have two data.frames, one
with an observation every month (per company ID), and one with an
observation every quarter (per company ID; note that quarter means
fiscal quarter; therefore 1Q = Jan, Feb, Mar is not necessarily
correct and als
Dear Dennis,
Thanks the a[a %n% b] function worked well for me.
THanks, for the help,
Natalie
--
View this message in context:
http://n4.nabble.com/Matching-Problem-tp1565841p1565910.html
Sent from the R help mailing list archive at Nabble.com.
__
R
Hi,
I have a problem with function match. I might not be using it properly?
I have two character vectors that contain a unique identifier:
gtype_prochi <- ("CAO1524452" "CAO0966182" "CAO9209719" "CAO4436178"
"CAO3761898"
"CAO3529266" "CAO2427148" "CAO8829776" "CAO2517174" "CAO5371418"
"CAO1535
On Wed, Aug 6, 2008 at 9:01 AM, Tom.O <[EMAIL PROTECTED]> wrote:
>
> 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
One option is:
strapply(mystring, "\\{[^\\}]+" , function(x)gsub("\\{", "", x), perl = F)
On Wed, Aug 6, 2008 at 10:01 AM, Tom.O <[EMAIL PROTECTED]> wrote:
>
> 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
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,"\\{[^\\}]+",, p
Here is a solution using strapply from the gsubfn package:
library(gsubfn)
strapply(myexstrings, "(\\w+).*", backref = -1, simplify = c)
It matches the first string of word characters following by
anything else and then returns the first backreference in
each match, i.e. the portion within parent
Thanks guys, all of you. You have just made this weekend a much more happier
weekend.
Regards Tom
Hans-Jörg Bibiko wrote:
>
>
> On 27 Jun 2008, at 13:56, Tom.O wrote:
>
>>
>> Well I have tried that and it's unfortuanally not the solution.
>> This return all the characters in the string, but
On 27 Jun 2008, at 13:56, Tom.O wrote:
Well I have tried that and it's unfortuanally not the solution.
This return all the characters in the string, but I dont want the
characters
after the ending non-character symbol. Only the starting characters
ore of
interest.
gsub("\\W*","", myexst
this should do what you want:
> myexstrings = c("*AAA.AA","BBB BB","*.CCC.","**dd- d")
> a = gsub("^\\W*","", myexstrings,perl=T)
> b = gsub("\\W.*", "", a, perl=T)
> b
[1] "AAA" "BBB" "CCC" "dd"
first one, removes any non-word characters from the beginning (as you
already figured out)
second o
Well I have tried that and it's unfortuanally not the solution.
This return all the characters in the string, but I dont want the characters
after the ending non-character symbol. Only the starting characters ore of
interest.
> gsub("\\W*","", myexstrings,perl=T)
[1] "A" "B" "CCC" "ddd"
On 27 Jun 2008, at 12:23, Tom.O wrote:
Hi R gurus
I have a matching problem that I cant solve. I have tried multiple
solutions
and searched varius help-sites but I cant get it to work.
This is the problem
myexstrings = c("*AAA.AA","BBB BB","*.CCC.","**dd- d")
what I want do do is to remov
Hi R gurus
I have a matching problem that I cant solve. I have tried multiple solutions
and searched varius help-sites but I cant get it to work.
This is the problem
myexstrings = c("*AAA.AA","BBB BB","*.CCC.","**dd- d")
what I want do do is to remove any non-characters in the beginning and
ever
819 4402
Home Phone: +61 7 3286 7700
mailto:[EMAIL PROTECTED]
http://www.cmis.csiro.au/bill.venables/
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Tom.O
Sent: Tuesday, 12 February 2008 8:44 PM
To: r-help@r-project.org
Subject: [R]
Here is one way of doing it:
> MyData <- c("Test1","Test2","I(Test1^2)","I(Test2^3)","I(Test1.Test2^2)")
> x <- gsub("^(.*\\(|)([^^)]*|.*).*", "\\2", MyData)
> x
[1] "Test1" "Test2" "Test1" "Test2" "Test1.Test2"
> unique(x)
[1] "Test1" "Test2" "Test1.Test2"
>
uot;^I\\((.*)\\^.+", "\\1\\", MyData)
[1] "Test1" "Test2" "Test1" "Test2" "Test1.Test2"
Now use unique on the result.
Regards
Søren
Fra: [EMAIL PROTECTED] på vegne af T
unique(gsub("^.*\\((.+)\\^.*", "\\1", MyData))
?
b
On Feb 12, 2008, at 5:44 AM, Tom.O wrote:
Hi
I have this vector of strings.
MyData <-
c("Test1","Test2","I(Test1^2)","I(Test2^3)","I(Test1.Test2^2)")
where I want to extract only the text after "I(" and before "^" so
that the
string re
Maybe:
all.vars(parse(text=paste(MyData, collapse="+")))
On 12/02/2008, Tom.O <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> I have this vector of strings.
>
> MyData <- c("Test1","Test2","I(Test1^2)","I(Test2^3)","I(Test1.Test2^2)")
> where I want to extract only the text after "I(" and before "^" so th
See this post:
https://stat.ethz.ch/pipermail/r-help/2008-February/153819.html
as well as the rest of that thread.
On Feb 12, 2008 5:44 AM, Tom.O <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> I have this vector of strings.
>
> MyData <- c("Test1","Test2","I(Test1^2)","I(Test2^3)","I(Test1.Test2^2)")
> w
Hi
I have this vector of strings.
MyData <- c("Test1","Test2","I(Test1^2)","I(Test2^3)","I(Test1.Test2^2)")
where I want to extract only the text after "I(" and before "^" so that the
string returned only contain c("Test1","Test2","Test1.Test2")
I am not very skilled in the use of matching patt
21 matches
Mail list logo