Thanks all! That did it.
On Thu, Jul 15, 2010 at 11:07 AM, Nikhil Kaza wrote:
> Building on Erik's solution and because it would easier to do date
> arithmetic..
>
> d1 <- as.character(date)
> d1 <- ifelse(nchar(d1)<4, paste(0,d1,sep=""),d1)
> d2 <- as.Date(date, "%m%d")
>
>
> On Jul 15, 2010, a
Building on Erik's solution and because it would easier to do date
arithmetic..
d1 <- as.character(date)
d1 <- ifelse(nchar(d1)<4, paste(0,d1,sep=""),d1)
d2 <- as.Date(date, "%m%d")
On Jul 15, 2010, at 1:21 PM, btc1 wrote:
Hello, I have a vector, "dates", as a series of 3 digit elements,
Try this:
gsub("^(.)", "\\1/", dates)
On Thu, Jul 15, 2010 at 2:21 PM, btc1 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 5
gsub("(.*)(.{2})","\\1/\\2",dates)
-
A R learner.
--
View this message in context:
http://r.789695.n4.nabble.com/Cut-a-within-elements-by-length-not-value-of-vectors-tp2290440p2290471.html
Sent from the R help mailing list archive at Nabble.com.
btc1 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
uot; "12/08"
"4/23" "15/06" "3/21"
Martyn
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of btc1
Sent: 15 July 2010 18:22
To: r-help@r-project.org
Subject: [R] Cut a within elements by length,
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 i
7 matches
Mail list logo