Re: [Rd] head.ts, tail.ts loses time

2024-06-13 Thread Georgi Boshnakov
is contiguous by definition there. Also, compatibility problems may not be a big concern for these functions. Georgi Boshnakov Date: Tue, 11 Jun 2024 09:13:49 -0400 From: Gabor Grothendieck To: Martin Maechler Cc: Spencer Graves , r-devel Subject: Re: [Rd] head.ts, tail.ts loses time Mes

Re: [Rd] head.ts, tail.ts loses time

2024-06-13 Thread Martin Maechler
> Spencer Graves > on Mon, 10 Jun 2024 09:45:46 -0500 writes: > Hi, Martin et al.: > On 6/10/24 9:32 AM, Martin Maechler wrote: >>> Spencer Graves >>> on Mon, 10 Jun 2024 07:50:13 -0500 writes: >> >> > Hi, Gabor et al.: Thanks for this. I should change

Re: [Rd] head.ts, tail.ts loses time

2024-06-13 Thread Martin Maechler
> Gabor Grothendieck > on Tue, 11 Jun 2024 09:13:49 -0400 writes: > It isn't really clear that it can't work. This does work by inserting NA's. > library(zoo) > as.ts(as.zoo(lynx)[ c(1:3, 7) ] ) > ## Time Series: > ## Start = 1821 > ## End = 1827 > ## Fre

Re: [Rd] head.ts, tail.ts loses time

2024-06-11 Thread Gabor Grothendieck
It isn't really clear that it can't work. This does work by inserting NA's. library(zoo) as.ts(as.zoo(lynx)[ c(1:3, 7) ] ) ## Time Series: ## Start = 1821 ## End = 1827 ## Frequency = 1 ## [1] 269 321 585 NA NA NA 3928 On Mon, Jun 10, 2024 at 10:32 AM Martin Maechler wro

Re: [Rd] head.ts, tail.ts loses time

2024-06-10 Thread Spencer Graves
Hi, Martin et al.: On 6/10/24 9:32 AM, Martin Maechler wrote: Spencer Graves on Mon, 10 Jun 2024 07:50:13 -0500 writes: > Hi, Gabor et al.: Thanks for this. I should change my > current application to use either zoo or xts, as Gabor > suggests. > However, I

Re: [Rd] head.ts, tail.ts loses time

2024-06-10 Thread Martin Maechler
> Spencer Graves > on Mon, 10 Jun 2024 07:50:13 -0500 writes: > Hi, Gabor et al.: Thanks for this. I should change my > current application to use either zoo or xts, as Gabor > suggests. > However, I was surprised to learn that "[.ts" does NOT > return an obj

Re: [Rd] head.ts, tail.ts loses time

2024-06-10 Thread Spencer Graves
Hi, Gabor et al.: Thanks for this. I should change my current application to use either zoo or xts, as Gabor suggests. However, I was surprised to learn that "[.ts" does NOT return an object of class "ts". I see that "head.default" and "head.matrix" both call "[", so "head" cannot re

Re: [Rd] head.ts, tail.ts loses time

2024-06-09 Thread Gabor Grothendieck
zoo overcomes many of the limitations of ts: library(zoo) as.ts(head(as.zoo(presidents))) ## Qtr1 Qtr2 Qtr3 Qtr4 ## 1945 NA 87 82 75 ## 1946 63 50 xts also works here. On Sun, Jun 9, 2024 at 12:04 PM Spencer Graves wrote: > > Hello, All: > > > The 'head' and

Re: [Rd] head.ts, tail.ts loses time

2024-06-09 Thread Josiah Parry
It looks like to me the class is being removed explicitly due to the use of as.numeric() On Sun, Jun 9, 2024 at 12:04 PM Spencer Graves wrote: > Hello, All: > > > The 'head' and 'tail' functions strip the time from a 'ts' > object. > Example: > > > > head(presidents) > [1] NA 87 82 75

[Rd] head.ts, tail.ts loses time

2024-06-09 Thread Spencer Graves
Hello, All: The 'head' and 'tail' functions strip the time from a 'ts' object. Example: > head(presidents) [1] NA 87 82 75 63 50 > window(presidents, 1945, 1946.25) Qtr1 Qtr2 Qtr3 Qtr4 1945 NA 87 82 75 1946 63 50 Below please find code for 'head.ts' and 'tail.ts' t