R Experts:

 

I am trying to isolate the numeric value of day from a string that might
look like "Cycle 1 Day 8" or "Cycle 12 Day 15".  

 

In essence, what I need is a function that can look at a character
string and tell me the location within the string where it matches with
a given string.  In this case, where within "Cycle 12 Day 15" is the
text "Day" located.

 

The following works in S+, but I haven't been able to locate a function
within R that does what regMatchPos does in S+.

(If possible, I'd like a function that works in both.)  

  

Can someone please help?

 

 

PKTimes$Day <- substring( PKTimes$Visit,
regMatchPos(PKTimes$Visit,"DAY")[,2] +2, nchar(PKTimes$Visit )

 

Thanks, 

Michael

 


	[[alternative HTML version deleted]]

