Re: [R] Replace element with pattern

2013-11-04 Thread arun
:22 AM, "mohan.radhakrish...@polarisft.com" wrote: Please ignore. This works. str_extract_all(a$Col1,"[0-9]+(,|/|)") Mohan From:        mohan.radhakrish...@polarisft.com To:        arun Cc:        R help Date:        11/04/2013 12:22 PM Subje

Re: [R] Replace element with pattern

2013-11-03 Thread mohan . radhakrishnan
Please ignore. This works. str_extract_all(a$Col1,"[0-9]+(,|/|)") Mohan From: mohan.radhakrish...@polarisft.com To: arun Cc: R help Date: 11/04/2013 12:22 PM Subject: Re: [R] Replace element with pattern Sent by:r-help-boun...@r-project.org Hi,

Re: [R] Replace element with pattern

2013-11-03 Thread mohan . radhakrishnan
2359296 used:15857920,committed:15892480,max:50331648|" > > str_extract(a$Col1,"[0-9]*(,|/|)") [1] "" "" Thanks From: arun To: R help Cc: "mohan.radhakrish...@polarisft.com" Date: 11/01/2013 06:40 PM Subject:Re: [R] Replace element

Re: [R] Replace element with pattern

2013-11-01 Thread arun
Hi, Try this: Lines1 <- readLines(textConnection("Peak Usage    : init:2359296, used:15859328, committed:15892480,max:50331648Current Usage : init:2359296 used:15857920,committed:15892480,max:50331648|---| Peak Usage    : init:2359296, used:15859328, committed:15892480,max:50

Re: [R] Replace element with pattern

2013-11-01 Thread mohan . radhakrishnan
:50331648|" Mohan From: jim holtman To: mohan.radhakrish...@polarisft.com Cc: R mailing list Date: 11/01/2013 05:17 PM Subject: Re: [R] Replace element with pattern try this: > x <- rbind("Peak Usage: init:2359296, used:15859328, committed:1589248

Re: [R] Replace element with pattern

2013-11-01 Thread jim holtman
try this: > x <- rbind("Peak Usage: init:2359296, used:15859328, > committed:15892480,max:50331648Current Usage : init:2359296, > used:15857920,committed:15892480, max:50331648|---|") > apply(x, 1, function(a) sub("(Current.*?[/|]).*", "\\1", a)) [1] "Peak Usage: init:235