[Rd] as.POSIXct/as.POSIXlt generics

Sklyar, Oleg (MI London) osklyar at maninvestments.com
Wed Mar 26 10:35:40 CET 2008


Hi,

I am trying to define the as.POSIXct as an S4 method for one of my
classes. Trying to define a generic, I am getting an error that it is
already differently defined in base. However, if I query for it, there
is no definition. Being in base, I also cannot really import it. If I
define methods without definig a generic, they will work but with a
warning that a new generic will be automatically created. See the code
chunk below. Any idea how to make it work w/o warnings?

All the same for as.POSIXlt.

Using S3 definition instead works for the parent class, but seems to
require an additional definition for derived ones, well, I'd rather
avoid S3.

Thanks, Oleg

Help page definition: 

> ?as.POSIXct
Usage:
as.POSIXct(x, tz = "")

osklyar:R > R
*** R version 2.6.2 (2008-02-08) ***
> getGeneric("as.POSIXct")
NULL

> setGeneric("as.POSIXct", function(x, tz)
standardGeneric("as.POSIXct"))
New generic for "as.POSIXct" does not agree with implicit generic from
package "base"; a new generic will be assigned with package ".GlobalEnv"
[1] "as.POSIXct"

osklyar:R > R
*** R version 2.6.2 (2008-02-08) ***
> source("TimeDate.R")
Creating a new generic function for "as.POSIXct" in ".GlobalEnv"
Creating a new generic function for "as.POSIXlt" in ".GlobalEnv"

The latter executes: setMethod("as.POSIXct", w/o setGeneric

> sessionInfo()
R version 2.6.2 (2008-02-08)
x86_64-unknown-linux-gnu

locale:
LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=C;LC_MO
NETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=
C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATI
ON=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

Dr Oleg Sklyar
Technology Group
Man Investments Ltd
+44 (0)20 7144 3803
osklyar at maninvestments.com


**********************************************************************
The contents of this email are for the named addressee(s) only.
It contains information which may be confidential and privileged.
If you are not the intended recipient, please notify the sender
immediately, destroy this email and any attachments and do not
otherwise disclose or use them. Email transmission is not a
secure method of communication and Man Investments cannot accept
responsibility for the completeness or accuracy of this email or
any attachments. Whilst Man Investments makes every effort to keep
its network free from viruses, it does not accept responsibility
for any computer virus which might be transferred by way of this
email or any attachments. This email does not constitute a request,
offer, recommendation or solicitation of any kind to buy, subscribe,
sell or redeem any investment instruments or to perform other such
transactions of any kind. Man Investments reserves the right to
monitor, record and retain all electronic communications through
its network to ensure the integrity of its systems, for record
keeping and regulatory purposes. 

Visit us at: www.maninvestments.com



More information about the R-devel mailing list