t;ppbzJG" "ppbzJG"
A.K.
From: Christofer Bogaso
To: arun
Cc: R help ; Bert Gunter
Sent: Sunday, August 11, 2013 2:19 PM
Subject: Re: [R] Working with string
Hello Arun,
Thank you for your prompt reply.
However if I use your new code, I am no
But posters frequently seem to disregard this.
>>
>> -- Bert
>>
>> On Sun, Aug 11, 2013 at 8:43 AM, arun wrote:
>> >
>> >
>> > Hi,
>> >
>> > May be this helps:
>> > chnew<-CH
>> >
>> > chnew[dupli
t; chnew[duplicated(toupper(CH1))]<-
> CH1[duplicated(toupper(CH1),fromLast=TRUE)]
> sort(chnew)
> #[1] "MRTZIt" "MRTZIt" "ppbzJG" "ppbzJG"
> A.K.
>
>
>
>
> From: Christofer Bogaso
> To: Bert G
MRTZIt" "ppbzJG" "ppbzJG"
A.K.
From: Christofer Bogaso
To: Bert Gunter
Cc: arun ; R help
Sent: Sunday, August 11, 2013 1:54 PM
Subject: Re: [R] Working with string
Thanks Bert and Arun for your help.
As Bert already pointed out, Arun's co
;well duhhh!"
> But posters frequently seem to disregard this.
>
> -- Bert
>
> On Sun, Aug 11, 2013 at 8:43 AM, arun wrote:
> >
> >
> > Hi,
> >
> > May be this helps:
> > chnew<-CH
> >
> chnew[duplicated(toupper(CH))]<-CH[dup
mLast=TRUE)]
> chnew
> #[1] "aBd""sTb""aBd""dFDasd" "asd""dFDasd"
> A.K.
>
>
> - Original Message -
> From: Christofer Bogaso
> To: r-help
> Cc:
> Sent: Sunday, August 11, 2013 8:3
fer Bogaso
To: r-help
Cc:
Sent: Sunday, August 11, 2013 8:39 AM
Subject: [R] Working with string
Hello again,
Let say I have a lengthy character vector like:
CH <- c("aBd", "sTb", "ABD", "dFDasd", "asd", "DFDASD")
Now I want to create
Oh, sorry. One type. Here's the correct version
On Sun, Aug 11, 2013 at 7:54 AM, Bert Gunter wrote:
> Christofer:
>
> You may have to fortify the following a bit to allow for the
> possibility that some of your caps strings don't match. But other than
> that, I think this will do:
>
>> CH <- c("a
Christofer:
You may have to fortify the following a bit to allow for the
possibility that some of your caps strings don't match. But other than
that, I think this will do:
> CH <- c("aBd", "sTb", "ABD", "dFDasd", "asd", "DFDASD")
> caps <- CH %in% z
> noncaps <- CH[!caps]
> chnew <- CH
> chnew[ca
Hello again,
Let say I have a lengthy character vector like:
CH <- c("aBd", "sTb", "ABD", "dFDasd", "asd", "DFDASD")
Now I want to create a vector like:
CH_New <- c("aBd", "sTb", "aBd", "dFDasd", "asd", "dFDasd") ## the 3rd and
6th element replaced
Basically, the goal is:
If an element has a
format(Vec,justify="right")
#[1] " sada" "asdsa" " sa"
A.K.
- Original Message -
From: Marc Schwartz
To: Christofer Bogaso
Cc: r-help
Sent: Thursday, March 14, 2013 11:02 AM
Subject: Re: [R] Working with string
On Mar 14, 2013, at 9:42 AM, Christofe
Duhhh... You already knew about nchar!!
So (untested):
nc <- nchar(vec)
mx <- max(nc)
blanks <- rep(" ",mx-nchar+1) ## +1 needed for rep
paddedvec <-substring(paste(vec,blanks,sep=""),1,mx)
You can also do this at one go with str_pad in the stringr package, found
by searching on "pad strings.'
On Mar 14, 2013, at 9:42 AM, Christofer Bogaso
wrote:
> Hello again,
>
> Let say I have following string:
>
> Vec <- c("sada", "asdsa", "sa")
>
> Now I want to make each element of this vector with equal length.
> Basically I want following vector:
>
> c("sada ", "asdsa", "sa ")
>
> There
K.
- Original Message -
From: Christofer Bogaso
To: r-help
Cc:
Sent: Thursday, March 14, 2013 10:42 AM
Subject: [R] Working with string
Hello again,
Let say I have following string:
Vec <- c("sada", "asdsa", "sa")
Now I want to make each element of th
?nchar will tell you how many characters are in each string (mod multibyte
locales)
and you can use this to extend any that are shorter than the max with
blanks or whatever.
-- Bert
On Thu, Mar 14, 2013 at 7:42 AM, Christofer Bogaso <
bogaso.christo...@gmail.com> wrote:
> Hello again,
>
> Let
Hello again,
Let say I have following string:
Vec <- c("sada", "asdsa", "sa")
Now I want to make each element of this vector with equal length.
Basically I want following vector:
c("sada ", "asdsa", "sa ")
Therefore we can get:
> nchar(c("sada ", "asdsa", "sa "))
[1] 5 5 5
Is there any
nks,
>
> -Original Message-
> From: Marc Schwartz [mailto:marc_schwa...@me.com]
> Sent: 07 July 2011 21:54
> To: Bogaso Christofer
> Cc: r-help@r-project.org
> Subject: Re: [R] Working with string
>
> On Jul 7, 2011, at 11:21 AM, Bogaso Christofer wrote:
>
t: 07 July 2011 21:54
To: Bogaso Christofer
Cc: r-help@r-project.org
Subject: Re: [R] Working with string
On Jul 7, 2011, at 11:21 AM, Bogaso Christofer wrote:
> Hi there, I have to extract some relevant portion from a defined
> string, which is a mix of numeric and character. However this
On Jul 7, 2011, at 11:21 AM, Bogaso Christofer wrote:
> Hi there, I have to extract some relevant portion from a defined string,
> which is a mix of numeric and character. However this has following
> sequence:
>
>
>
> Some String - Some numerical - "c/C" (or "p/P") - then again some set of
> n
Hi there, I have to extract some relevant portion from a defined string,
which is a mix of numeric and character. However this has following
sequence:
Some String - Some numerical - "c/C" (or "p/P") - then again some set of
numbers.
Examples of such string is "fdahsdfcha163517253c463278643"
20 matches
Mail list logo