Try this:
 gsub("^(.)", "\\1/", dates)



On Thu, Jul 15, 2010 at 2:21 PM, btc1 <btcaldwell@berkeley.edu> wrote:

>
> Hello, I have a vector, "dates", as a series of 3 digit elements, i.e. >
> date
>  [1] 528 528 528 528 528 528 528 528 528 528 528 528 708 708 708 708 708
> 708
>  [19] 708 708 708 708 529 529 529 529 529 529 529 529 529 529 529 529 529
> 529
>  [37] 529 624
>
> I need to convert them into julian, but have to insert a "/" or "-" after
> the first number within each element of the vector (5/28 5/28 etc). Found
> plenty functions to replace by a pattern but not to cut by a certain number
> of digits with an element. Alternately, if I could run all the elements
> into
> one long vector and then cut every one then two digits, that would work as
> well.
>
> Thanks.
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Cut-a-within-elements-by-length-not-value-of-vectors-tp2290440p2290440.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

