Displaying 20 results from an estimated 6000 matches similar to: "Extract time only from POSIXlt object"
2004 Nov 21
3
Help with ooplot(gplots) and error bars
Dear All
I am trying to graph a proportion and CI95% by a factor with ooplot (any
other better solution ?)
It works well until I try to add the confidence interval.
this is the error message and and a description of the data:
> dat1
PointEst
TT1 1 3.6
TT2 2 5.0
TT3 3 5.8
TT4 4 11.5
TT5 5 7.5
TT5 6 8.7
TT7 7 17.4
> dat2
2002 Apr 02
1
cbind.ts bug?
The following creates a time series tt1 whose values rise from 1
to 20 and another time series tt2 each of whose values are 10 larger
than the corresponding value in tt1. When we attempt to bind them
together as columns, the entry after Dec 1960 is erroneously listed
as NA 1960 instead of Jan 1961. If n is changed to either 19 or is
changed to 21 in the example below, the example suddenly
2009 Dec 01
4
median for time data
Hi everybody
How do I do to calculate the median and average of a colum of time data like
this: "8:50:10". I also need to plot the time difference between two colums
Thanks a lot
--
View this message in context: http://n4.nabble.com/median-for-time-data-tp932287p932287.html
Sent from the R help mailing list archive at Nabble.com.
2008 Dec 05
2
xtable html links
Hi,
I was trying to get hyperlinks using xtable, but couldn't get the hyperlinks to function properly. For example, if I use
## Try to link NY times website to every figure in column 4
mat <- matrix(1:43,6,5)
mat[,5] <- "http://nytimes.com"
for(i in 1:nrow(mat)){
strr <- paste('<a href="', mat[i,5],'">', mat[i,4], '</a>',
2004 Feb 06
2
vector of factors to POSIXlt
hello,
I have a vector of factors
> str(rcptdt)
Factor w/ 51 levels "1/10/03","1/13/03",..:
> length(rcptdt)
[1] 87
which i want to convert to class POSIXlt to extract the day, so:
a1<-format(rcptdt,"%m/%d/%y")
> length(a1)
[1] 87
and:
a2<-strptime(a1, "%m/%d/%y")
str(a2)
`POSIXlt', format: chr [1:87] "2002-04-18"
2004 Mar 08
5
years from as.POSIXlt
Hi,
how it's possible to extract the year and the number
of days from Julian date. i'm little confused about the last two
functions and ?years .
EDATE comes from sqlQuery with as.is=T
EDATE <- as.POSIXlt(datvears$ENROLLDAY)
Many thanks, Christian
> EDATE[1:5]
[1] "2000-06-30 11:25:01" "2000-06-30 11:39:55" "2000-06-30 12:11:11"
[4]
2011 Mar 08
1
Date arithmetic coerces POSIXlt to POSIXct?
Hi. This feels like a bug to me, or at least an undocumented feature,
but I thought I'd see what people here thought of it. Consider a POSIXlt
object like this one:
> a <- as.POSIXlt ("2011-01-23 12:45:45")
> class (a)
[1] "POSIXlt" "POSIXt"
Fine. Now, if I do some arithmetic on that object, the result is
converted to POSIXct.
> class (a
2006 Feb 09
1
List Conversion
Hello,
I have a list (mode and class are list) in R that is many elements long and of the form:
>length(list)
[1] 5778
>list[1:4]
$ID1
[1] "num1"
$ID2
[1] "num2" "num3"
$ID3
[1] "num4"
$ID4
[1] NA
I'd like to convert the $ID2 value to be in one element rather than in two.?? It shows up as c(\"num2\", \"num3\") if I try to use
2011 Mar 24
5
subset and as.POSIXct / as.POSIXlt oddness
Dear R users,
Given this data:
x <- seq(1,100,1)
dx <- as.POSIXct(x*900, origin="2007-06-01 00:00:00")
dfx <- data.frame(dx)
Now to play around for example:
subset(dfx, dx > as.POSIXct("2007-06-01 16:00:00"))
Ok. Now for some reason I want to extract the datapoints between hours
10:00:00 and 14:00:00, so I thought well:
subset(dfx, dx >
2016 Dec 06
1
segfault with POSIXlt zone=NULL zone=""
>>>>> Joshua Ulrich <josh.m.ulrich at gmail.com>
>>>>> on Tue, 6 Dec 2016 09:51:16 -0600 writes:
> On Tue, Dec 6, 2016 at 6:37 AM, <frederik at ofb.net> wrote:
>> Hi all,
>>
>> I ran into a segfault while playing with dates.
>>
>> $ R --no-init-file
>> ...
>> >
2016 Dec 06
1
segfault with POSIXlt zone=NULL zone=""
Hi Joshua,
Thank you for minimizing my test case.
> > Hope I'm not doing something illegal...
> >
> You are. You're changing the internal structure of a POSIXlt object
> by re-ordering the list elements. You should not expect a malformed
> POSIXlt object to behave as if it's correctly formed. You can see
> it's malformed by comparing it's
2010 Jul 14
1
POSIXlt error for 1982-01-01
Hi, I am encountering a strange error in POSIXlt... anyone got a clue?
> as.POSIXlt("1982-01-01")
Error in as.POSIXlt.character("1982-01-01") :
character string is not in a standard unambiguous format
> as.POSIXlt("1992-01-01")
[1] "1992-01-01"
> as.POSIXlt("1972-01-01")
[1] "1972-01-01"
> as.POSIXlt("1962-01-01")
2012 Sep 05
2
POSIXlt and daylight savings time
I have a data frame that contains dates, but when I use as.POSIXlt() I lose
the hours on all records. I traced this down to a particuar hour which
causes the issue...
> as.POSIXlt('2004-10-31 02:00:00')
[1] "2004-10-31"
> as.POSIXlt('2004-10-31 03:00:00')
[1] "2004-10-31 03:00:00"
How do I tell as.POSIXlt() to ignore daylight savings and just convert to
2011 Feb 04
2
terribly annoying bug with POSIXlt : one o'clock is midnight?
Apparently, as.POSIXlt takes one o'clock as the start of the day :
> as.POSIXlt(0,origin="1970-01-01")
[1] "1970-01-01 01:00:00 CET"
> as.POSIXlt(0,origin="1970-01-01 00:00:00")
[1] "1970-01-01 01:00:00 CET"
> as.POSIXlt(0,origin="1970-01-01 23:59:59")
[1] "1970-01-02 00:59:59 CET"
Cheers
--
Joris Meys
Statistical
2010 Jul 14
1
POSIXlt error
Hi, I'm encountering a strange error in POSIXlt... anyone got a clue on
this?
> as.POSIXlt("1982-01-01")
Error in as.POSIXlt.character("1982-01-01") :
character string is not in a standard unambiguous format
> as.POSIXlt("1992-01-01")
[1] "1992-01-01"
> as.POSIXlt("1972-01-01")
[1] "1972-01-01"
>
2011 Mar 01
2
Does POSIXlt extract date components properly?
I would like to use POSIX classes to store dates and extract components of
dates. Following the example in Spector ("Data Manipulation in R"), I
create a date
> mydate = as. POSIXlt('2005-4-19 7:01:00')
I then successfully extract the day with the command
> mydate$day
[1] 19
But when I try to extract the month
> mydate$mon
[1] 3
it returns the wrong month. And
2013 Apr 24
1
Floating point precision causing undesireable behaviour when printing as.POSIXlt times with microseconds?
Dear list,
When using as.POSIXlt with times measured down to microseconds the default format.POSIXlt seems to cause some possibly undesirable behaviour:
According to the code in format.POSIXlt the maximum accuracy of printing fractional seconds is 1 microsecond, but if I do;
options( digits.secs = 6 )
as.POSIXlt( 1.000002 , tz="", origin="1970-01-01")
as.POSIXlt( 1.999998 ,
2008 Feb 17
1
How to make a vector/list/array of POSIXlt object?
Hi Guys,
I'm cooking up my time series code. I want a data frame with first column as timestamp in POSIXlt format.
I hit on this the problem of how to create an array/list/vector of POSIXlt objects. Code is as follows
> dtt=array(dim = 2)
> t=as.POSIXlt( strptime("07/12/07 13:20:01", "%m/%d/%Y %H:%M:%S",tz="GMT"))
> dtt
[1] NA NA
> t
[1]
2008 Oct 05
2
Time Interval calculation using R
Hi
I have two columns of data with time in form of HH:MM:SS - representing
start time and end time of an activity. I am trying to calculate the time
difference (duration of the activity).
(1) I first tried
> difftime(btime, etime, units = "mins")
This however gave me the error - Error in
as.POSIXlt.character(as.character(x)) : character string is not in a
standard unambiguous
2011 Aug 07
1
all.equal doesn't work for POSIXlt objects
Hi all,
following sample code illustrates the problem :
Date1 <- Date2 <-
as.POSIXlt(seq.Date(as.Date("2010-04-01"),as.Date("2011-04-01"),by='day'))
identical(Date1,Date2)
all.equal(Date1,Date2)
identical() gives the correct answer. As there is no all.equal method
for POSIXlt objects, all.equal.list is used instead. Subsetting using
[[]] doesn't work