Dear all,
I would like to know the month on a string formatted as "2004-01", using as.Date
(not just stripping the string !)
?as.Date says that in case of an incomplete input string, the answer is
system-specific.
The following has been tested on R 2.4.1, on Ubuntu Linux and WinXP.
> mydate <-
On Sun, 07-Jan-2007 at 12:01PM +, Mark Wardle wrote:
|> Dear all,
|>
|> The as.Date() function appears to give different results depending on
|> the order of the vector passed into it.
|>
|> d1 = c("1900-01-01", "2007-01-01","","2001-05-03")
|> d2 = c("", "1900-01-01", "2007-01-01","2001-05-
Prof Brian Ripley wrote:
> The correct work-around is to get non-valid strings returned as NA, not
> "". That is argument 'na.strings' in RODBC (and elsewhere: read.table
> behaves in the same way).
>
Thanks for these replies.
As I have mentioned before, my peculiar combination of PostgreSQL,
On Sun, 7 Jan 2007, Mark Wardle wrote:
> Dear all,
>
> The as.Date() function appears to give different results depending on
> the order of the vector passed into it.
>
> d1 = c("1900-01-01", "2007-01-01","","2001-05-03")
> d2 = c("", "1900-01-01", "2007-01-01","2001-05-03")
> as.Date(d1) # give
On Sun, 2007-01-07 at 12:01 +, Mark Wardle wrote:
> Dear all,
>
> The as.Date() function appears to give different results depending on
> the order of the vector passed into it.
>
> d1 = c("1900-01-01", "2007-01-01","","2001-05-03")
> d2 = c("", "1900-01-01", "2007-01-01","2001-05-03")
> as.D
Dear all,
The as.Date() function appears to give different results depending on
the order of the vector passed into it.
d1 = c("1900-01-01", "2007-01-01","","2001-05-03")
d2 = c("", "1900-01-01", "2007-01-01","2001-05-03")
as.Date(d1) # gives correct results
as.Date(d2) # fails with error
Try this:
# test data
y <- 0:1000 # values
dd <- Sys.Date() + y # Dates
# create zoo object, aggregate it by year using last value and plot it
z <- zoo(y, dd)
yr <- function(x) as.POSIXlt(x)$year + 1900
# or, yr <- function(x) as.numeric(format(x, "%Y"))
z.yr <- aggregate(z, yr, tail, 1)
plot(z.
dear list,
i have a problem plotting revenue against the date.
the str. of date looks like:
Class 'Date' num [1:10493] -3649 -3648 -3647 -3646 -3643 ...
the head looks like:
[1] "1960-01-05" "1960-01-06" "1960-01-07" "1960-01-08" "1960-01-11"
[6] "1960-01-12"
i´d like to plot it against th
The following is a minor modification of examples in the help for
"as.Date":
> x <- c("1jan1960", "2jan1960", "31mar1960", "30jul2006")
> z <- as.Date(x, "%d%b%Y")
> z< Sys.Date()
[1] TRUE TRUE TRUE FALSE
How's this?
spencer graves
Omar Lakkis wrote:
> I hav
I have a Date variable that I constructed with as.Date()
How ca I compare it to today (<,>,==) ?
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-gu
You do need R 1.9.0 or later. On the other hand, `the manual' (which
manual) should only refer to as.Date in 1.9.0 or later. If you are
using R 1.9.0, something is wrong (as that code is run as part of the
installation checks).
(`or later' here means one of the r-patched or r-devel snapshots.
Hi. I'm sure this is a complete green-horn question. I apologize.
I'm trying to use as.Date *exactly* as shown on p. 194 of the manual (code
fragment and error message pasted below). Is there some kind of "include"
or "import" statement that I need to issue? Thank you very much for saving
wha
12 matches
Mail list logo