Hi Jeff,
Most likely the "Event Date" field is a factor. Try this:
df$Event.Date <- as.Date(as.character(df$Event.Date),
"%d-%b-%y")
Also beware of Excel's habit of silently converting mixed date formats
(i.e. dd/mm/ and mm/dd/) to one or the other format. The only
way I know to prevent
R-Help Group
What is the proper way to convert excel date formats to R-Date format.
Event ID
Event Date
Event Type
250013
1-Jan-09
NSAG Attack
250015
1-Jan-09
NSAG Attack
250016
1-Jan-09
NSAG Attack
Obviously this is wrong
df$Event.Date <- as.Date(df$Event.Da
"%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
="%d%b%Y")
x
[1] "1928-10-01" "1928-10-02" "1928-10-03" "1928-10-04"
A.K.
----- Original Message -
From: Data Analytics Corp.
To: r-help@r-project.org
Cc:
Sent: Tuesday, June 19, 2012 8:00 AM
Subject: [R] Date formats
Hi,
I imported a
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
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 average closings against date using ggplot2?
Thanks,
Walt
_
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:
>
>
I have trouble with this:
as.Date("Sep-1981", format="%b-%Y")
Returns "NA"
>From documentation for strftime
'%b' Abbreviated month name in the current locale. (Also matches
full name on input.)
'%Y' Year with century.
What am I doing wrong?
cheers
Worik
[[alternative H
, 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)
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)
[1] 13877
> ifelse(TRUE, as.character(date-1), date)
[1] "2007-12-29"
> if (TRUE) {date}
[1] "2007-12-30"
It
17 matches
Mail list logo