"%d%b%Y")
library(zoo)as.yearmon(x1)
[1] "Oct 1928" "Nov 1928" "Dec 1928" "Jan 1929"
A.K.
- Original Message -
From: arun
To: "w...@dataanalyticscorp.com"
Cc: R help
Sent: Tuesday, June 19, 2012 7:04 PM
Subject: Re: [R] Da
Hi,
Try this:
str1<-c("01OCT1928","02OCT1928","03OCT1928","04OCT1928")
strptime(str1,"%d%b%Y")
[1] "1928-10-01" "1928-10-02" "1928-10-03" "1928-10-04"
#or you can use this:
x<-as.Date(str1,format="%d%b%Y")
x
[1] "1928-10-01" "1928-10-02" "1928-10-03" "1928-10-04"
A.K.
- Original M
Hello,
Try
as.Date("01OCT1928", format="%d%b%Y")
[1] "1928-10-01"
Note that though probably not a problem to you, this is locale specific.
In Portugal, the string corresponding to the same date would be
"01OUT1928". The variable to set using Sys.setlocale() would be LC_TIME.
For date forma
Hi Walt,
as.Date("01OCT1928", "%d%b%Y") works for me. See also ?strftime
Regards,
Jon
On Tue, Jun 19, 2012 at 8:00 PM, Data Analytics Corp.
wrote:
> Hi,
>
> I imported an excel table (using read.csv) of Dow Jones monthly average
> closings where the first variable is a date as a character str
On Jun 19, 2012, at 8:00 AM, Data Analytics Corp. wrote:
Hi,
I imported an excel table (using read.csv) of Dow Jones monthly
average closings where the first variable is a date as a character
string such as "01OCT1928". How do I convert this to a date
variable so I can plot monthly aver
Try this:
> library(zoo)
> as.yearmon("Sep-1981", "%b-%Y")
[1] "Sep 1981"
> as.Date(as.yearmon("Sep-1981", "%b-%Y"))
[1] "1981-09-01"
> as.Date(paste(1, "Sep-1981"), "%d %b-%Y")
[1] "1981-09-01"
On Thu, Sep 24, 2009 at 7:15 PM, Worik R wrote:
> I have trouble with this:
>
> as.Date("Sep-1981"
Worik,
You need a day!
as in:
as.Date("1-Sep-1981", format="%d-%b-%Y") ## first of the month
HTH,
Jim Porzak
Ancestry.com
San Francisco, CA
www.linkedin.com/in/jimporzak
use R! Group SF: www.meetup.com/R-Users/
On Thu, Sep 24, 2009 at 4:15 PM, Worik R wrote:
> I have trouble with this:
>
>
, d, "1996-1-1")
[[1]]
[1] "1994-03-04" "1996-03-01"
[[2]]
[1] "1996-1-1"
Any attempts to unlist, paste, etc. to remove the list structure
converted/removed the Date class.
Mikkel
- Original Message
From: Peter Dalgaard <[EMAIL PROTECTED]>
To
On Dec 30, 2007 10:47 AM, Peter Dalgaard <[EMAIL PROTECTED]> wrote:
> Gabor Grothendieck wrote:
> > Read the warning in ?ifelse
> Yep.
>
> And, yes, it is annoying that ifelse() strips attributes, including
> class, but it is one of those things that have been in the S languages
> "forever", and no
Gabor Grothendieck wrote:
> Read the warning in ?ifelse
Yep.
And, yes, it is annoying that ifelse() strips attributes, including
class, but it is one of those things that have been in the S languages
"forever", and nobody really wants to mess with. The fundamental issue
is that you need the re
?ifelse will give you
Warning
The mode of the result may depend on the value of test, and the class
attribute of the result is taken from test and may be inappropriate for the
values selected from yes and no.
i think it might answer your question,
Weiwei
On Dec 30, 2007 1:45 AM, Mikkel Grum <
Read the warning in ?ifelse
On Dec 30, 2007 1:45 AM, Mikkel Grum <[EMAIL PROTECTED]> wrote:
> Is the following expected behaviour for a date used in
> an ifelse function?
>
> > date <- Sys.Date()
> > date
> [1] "2007-12-30"
> > ifelse(TRUE, date-1, date)
> [1] 13876
> > ifelse(FALSE, date-1, date)
12 matches
Mail list logo