On 22 September 2008 at 15:41, Lee, Philip \(IT\) wrote:
| r-devel,
|
| One other question just occurred to me - does R have any concept of
| times alone? I can see that there's dates, and datetimes (POSIXct etc),
| but how should I represent 12:34:56 as just a time?
AFAIK you cannot as there i
eptember 17, 2008 4:19 PM
>> To: Lee, Philip (IT)
>> Cc: r-devel@r-project.org
>> Subject: Re: [Rd] Dates in C api
>>
>> If you are looking for examples of handling dates/times (specifically
>> POSIXct) within C code, the dev branch of xts has quite a bit of code
>>
TED]
> Sent: Wednesday, September 17, 2008 4:19 PM
> To: Lee, Philip (IT)
> Cc: r-devel@r-project.org
> Subject: Re: [Rd] Dates in C api
>
> If you are looking for examples of handling dates/times (specifically
> POSIXct) within C code, the dev branch of xts has quite a bit of c
Thanks, everyone, for the responses. That's exactly what I was after.
Regards,
Phil
> -Original Message-
> From: Jeff Ryan [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 17, 2008 4:19 PM
> To: Lee, Philip (IT)
> Cc: r-devel@r-project.org
> Subject:
If you are looking for examples of handling dates/times (specifically
POSIXct) within C code, the dev branch of xts has quite a bit of code
now.
http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/dev/pkg/src/?root=xts
Assigning the class (or any attribute) within the C code will be much
fast
On 9/17/2008 1:24 PM, Lee, Philip (IT) wrote:
r-devel,
I've been trying to write a C plugin for R, and I'm struggling to
understand how dates are represented.
I can create a date in R:
mydate<-as.Date(1, origin="1900-01-01") mydate
[1] "1900-01-02"
See ?Date for the internal represention: i
Dates are number of days since 1970-01-01 that is it.
to get data of Date in C:
library(inline)
code = 'Rprintf("%f", REAL(x)[0]); return R_NilValue;'
f = cfunction(signature(x="double"), body=code)
na = f(Sys.date())
to create an object of class Date:
--- in C ---
SEXP res = allocVector(REALSX