Re: [R] Creating zoo object on monthly time series

2008-06-01 Thread Gabor Grothendieck
On Sun, Jun 1, 2008 at 8:47 AM, Gabor Grothendieck
[EMAIL PROTECTED] wrote:
 On Sun, Jun 1, 2008 at 8:35 AM, Megh Dal [EMAIL PROTECTED] wrote:
 Hi all,

 I have following monthly time series :

 head(data1)
  V1 V2  V3
 1 Nov-80 NA 1007.44
 2 Dec-80 NA  982.05
 3 Jan-81 NA  994.25
 4 Feb-81 NA  996.31
 5 Mar-81 NA  939.91
 6 Apr-81 NA  923.32

 If the suggestion below does not work then try
 dput(head(data1)) to display it in an unambiguous form that is
 readily re-input into R.


 Now I want to convert it to a 'zoo' object. I wrote following syntax :

 ss = zoo(data1[,3], as.Date(data1[,1], format=%m/%y))


 See ?strptime and try %b-%y

That should be:

   z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))

or, if you want it as Date instead of yearmon:

   z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))


 However I got following :
 head(ss)
   NANANANANANA
 1007.44  982.05  994.25  996.31  939.91  923.32


 Can anyone please tell me what will be the correct syntax?

 Thanks



[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating zoo object on monthly time series

2008-06-01 Thread Gabor Grothendieck
On Sun, Jun 1, 2008 at 8:35 AM, Megh Dal [EMAIL PROTECTED] wrote:
 Hi all,

 I have following monthly time series :

 head(data1)
  V1 V2  V3
 1 Nov-80 NA 1007.44
 2 Dec-80 NA  982.05
 3 Jan-81 NA  994.25
 4 Feb-81 NA  996.31
 5 Mar-81 NA  939.91
 6 Apr-81 NA  923.32

If the suggestion below does not work then try
dput(head(data1)) to display it in an unambiguous form that is
readily re-input into R.


 Now I want to convert it to a 'zoo' object. I wrote following syntax :

 ss = zoo(data1[,3], as.Date(data1[,1], format=%m/%y))


See ?strptime and try %b-%y

 However I got following :
 head(ss)
   NANANANANANA
 1007.44  982.05  994.25  996.31  939.91  923.32


 Can anyone please tell me what will be the correct syntax?

 Thanks



[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating zoo object on monthly time series

2008-06-01 Thread Megh Dal
I got following:

 z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))
 head(z)
Jan 0001 Jan 0002 Jan 0003 Jan 0004 Jan 0005 Jan 0006 
 1206.68   782.45  1187.00  1398.77  1883.23  1431.80 

 z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))
 head(z)
0001-01-01 0002-01-01 0003-01-01 0004-01-01 0005-01-01 0006-01-01 
   1206.68 782.451187.001398.771883.231431.80 

Nowhere 1980 is coming. Any better suggestion?

Gabor Grothendieck [EMAIL PROTECTED] wrote: On Sun, Jun 1, 2008 at 8:47 AM, 
Gabor Grothendieck
 wrote:
 On Sun, Jun 1, 2008 at 8:35 AM, Megh Dal  wrote:
 Hi all,

 I have following monthly time series :

 head(data1)
  V1 V2  V3
 1 Nov-80 NA 1007.44
 2 Dec-80 NA  982.05
 3 Jan-81 NA  994.25
 4 Feb-81 NA  996.31
 5 Mar-81 NA  939.91
 6 Apr-81 NA  923.32

 If the suggestion below does not work then try
 dput(head(data1)) to display it in an unambiguous form that is
 readily re-input into R.


 Now I want to convert it to a 'zoo' object. I wrote following syntax :

 ss = zoo(data1[,3], as.Date(data1[,1], format=%m/%y))


 See ?strptime and try %b-%y

That should be:

   z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))

or, if you want it as Date instead of yearmon:

   z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))


 However I got following :
 head(ss)
   
 1007.44  982.05  994.25  996.31  939.91  923.32


 Can anyone please tell me what will be the correct syntax?

 Thanks



[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




   
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating zoo object on monthly time series

2008-06-01 Thread Gabor Grothendieck
You need to unambiguously specify what your data
looks like.  Please provide the dput output as previously
requested.  Also what version of zoo are you using?

packageDescription(zoo)$Version


On Sun, Jun 1, 2008 at 9:37 AM, Megh Dal [EMAIL PROTECTED] wrote:
 I got following:

 z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))
 head(z)
 Jan 0001 Jan 0002 Jan 0003 Jan 0004 Jan 0005 Jan 0006
  1206.68   782.45  1187.00  1398.77  1883.23  1431.80

 z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))
 head(z)
 0001-01-01 0002-01-01 0003-01-01 0004-01-01 0005-01-01 0006-01-01
1206.68 782.451187.001398.771883.231431.80

 Nowhere 1980 is coming. Any better suggestion?

 Gabor Grothendieck [EMAIL PROTECTED] wrote:

 On Sun, Jun 1, 2008 at 8:47 AM, Gabor Grothendieck
 wrote:
 On Sun, Jun 1, 2008 at 8:35 AM, Megh Dal wrote:
 Hi all,

 I have following monthly time series :

 head(data1)
 V1 V2 V3
 1 Nov-80 NA 1007.44
 2 Dec-80 NA 982.05
 3 Jan-81 NA 994.25
 4 Feb-81 NA 996.31
 5 Mar-81 NA 939.91
 6 Apr-81 NA 923.32

 If the suggestion below does not work then try
 dput(head(data1)) to display it in an unambiguous form that is
 readily re-input into R.


 Now I want to convert it to a 'zoo' object. I wrote following syntax :

 ss = zoo(data1[,3], as.Date(data1[,1], format=%m/%y))


 See ?strptime and try %b-%y

 That should be:

 z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))

 or, if you want it as Date instead of yearmon:

 z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))


 However I got following :
 head(ss)

 1007.44 982.05 994.25 996.31 939.91 923.32


 Can anyone please tell me what will be the correct syntax?

 Thanks



 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.





__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating zoo object on monthly time series

2008-06-01 Thread Gabor Grothendieck
Also here is an example showing it works with the assumed
format and zoo version:

 data1 - structure(list(V1 = structure(c(6L, 2L, 4L, 3L, 5L, 1L), .Label = 
 c(Apr-81,
+ Dec-80, Feb-81, Jan-81, Mar-81, Nov-80), class = factor),
+ V2 = c(NA, NA, NA, NA, NA, NA), V3 = c(1007.44, 982.05, 994.25,
+ 996.31, 939.91, 923.32)), .Names = c(V1, V2, V3), class =
data.frame, row.names = c(1,
+ 2, 3, 4, 5, 6))

 data1
  V1 V2  V3
1 Nov-80 NA 1007.44
2 Dec-80 NA  982.05
3 Jan-81 NA  994.25
4 Feb-81 NA  996.31
5 Mar-81 NA  939.91
6 Apr-81 NA  923.32

 zoo(data1[,3], as.yearmon(data1[,1], %b-%y))
Nov 1980 Dec 1980 Jan 1981 Feb 1981 Mar 1981 Apr 1981
 1007.44   982.05   994.25   996.31   939.91   923.32

 zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))
1980-11-01 1980-12-01 1981-01-01 1981-02-01 1981-03-01 1981-04-01
   1007.44 982.05 994.25 996.31 939.91 923.32

 packageDescription(zoo)$Version
[1] 1.5-3


On Sun, Jun 1, 2008 at 9:44 AM, Gabor Grothendieck
[EMAIL PROTECTED] wrote:
 You need to unambiguously specify what your data
 looks like.  Please provide the dput output as previously
 requested.  Also what version of zoo are you using?

 packageDescription(zoo)$Version


 On Sun, Jun 1, 2008 at 9:37 AM, Megh Dal [EMAIL PROTECTED] wrote:
 I got following:

 z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))
 head(z)
 Jan 0001 Jan 0002 Jan 0003 Jan 0004 Jan 0005 Jan 0006
  1206.68   782.45  1187.00  1398.77  1883.23  1431.80

 z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))
 head(z)
 0001-01-01 0002-01-01 0003-01-01 0004-01-01 0005-01-01 0006-01-01
1206.68 782.451187.001398.771883.231431.80

 Nowhere 1980 is coming. Any better suggestion?

 Gabor Grothendieck [EMAIL PROTECTED] wrote:

 On Sun, Jun 1, 2008 at 8:47 AM, Gabor Grothendieck
 wrote:
 On Sun, Jun 1, 2008 at 8:35 AM, Megh Dal wrote:
 Hi all,

 I have following monthly time series :

 head(data1)
 V1 V2 V3
 1 Nov-80 NA 1007.44
 2 Dec-80 NA 982.05
 3 Jan-81 NA 994.25
 4 Feb-81 NA 996.31
 5 Mar-81 NA 939.91
 6 Apr-81 NA 923.32

 If the suggestion below does not work then try
 dput(head(data1)) to display it in an unambiguous form that is
 readily re-input into R.


 Now I want to convert it to a 'zoo' object. I wrote following syntax :

 ss = zoo(data1[,3], as.Date(data1[,1], format=%m/%y))


 See ?strptime and try %b-%y

 That should be:

 z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))

 or, if you want it as Date instead of yearmon:

 z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))


 However I got following :
 head(ss)

 1007.44 982.05 994.25 996.31 939.91 923.32


 Can anyone please tell me what will be the correct syntax?

 Thanks



 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.






__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating zoo object on monthly time series

2008-06-01 Thread Megh Dal
 packageDescription(zoo)$Version
[1] 1.1-1


Gabor Grothendieck [EMAIL PROTECTED] wrote: You need to unambiguously specify 
what your data
looks like.  Please provide the dput output as previously
requested.  Also what version of zoo are you using?

packageDescription(zoo)$Version


On Sun, Jun 1, 2008 at 9:37 AM, Megh Dal  wrote:
 I got following:

 z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))
 head(z)
 Jan 0001 Jan 0002 Jan 0003 Jan 0004 Jan 0005 Jan 0006
  1206.68   782.45  1187.00  1398.77  1883.23  1431.80

 z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))
 head(z)
 0001-01-01 0002-01-01 0003-01-01 0004-01-01 0005-01-01 0006-01-01
1206.68 782.451187.001398.771883.231431.80

 Nowhere 1980 is coming. Any better suggestion?

 Gabor Grothendieck  wrote:

 On Sun, Jun 1, 2008 at 8:47 AM, Gabor Grothendieck
 wrote:
 On Sun, Jun 1, 2008 at 8:35 AM, Megh Dal wrote:
 Hi all,

 I have following monthly time series :

 head(data1)
 V1 V2 V3
 1 Nov-80 NA 1007.44
 2 Dec-80 NA 982.05
 3 Jan-81 NA 994.25
 4 Feb-81 NA 996.31
 5 Mar-81 NA 939.91
 6 Apr-81 NA 923.32

 If the suggestion below does not work then try
 dput(head(data1)) to display it in an unambiguous form that is
 readily re-input into R.


 Now I want to convert it to a 'zoo' object. I wrote following syntax :

 ss = zoo(data1[,3], as.Date(data1[,1], format=%m/%y))


 See ?strptime and try %b-%y

 That should be:

 z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))

 or, if you want it as Date instead of yearmon:

 z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))


 However I got following :
 head(ss)

 1007.44 982.05 994.25 996.31 939.91 923.32


 Can anyone please tell me what will be the correct syntax?

 Thanks



 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.






   
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating zoo object on monthly time series

2008-06-01 Thread Gabor Grothendieck
Please upgrade to the latest version of zoo.  as.yearmon.factor
was only added to zoo in recent versions and its likely your date
column is a factor.

If that is not the problem then please provide the dput output as
requested.

On Sun, Jun 1, 2008 at 9:59 AM, Megh Dal [EMAIL PROTECTED] wrote:
 packageDescription(zoo)$Version
 [1] 1.1-1


 Gabor Grothendieck [EMAIL PROTECTED] wrote:

 You need to unambiguously specify what your data
 looks like. Please provide the dput output as previously
 requested. Also what version of zoo are you using?

 packageDescription(zoo)$Version


 On Sun, Jun 1, 2008 at 9:37 AM, Megh Dal wrote:
 I got following:

 z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))
 head(z)
 Jan 0001 Jan 0002 Jan 0003 Jan 0004 Jan 0005 Jan 0006
 1206.68 782.45 1187.00 1398.77 1883.23 1431.80

 z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))
 head(z)
 0001-01-01 0002-01-01 0003-01-01 0004-01-01 0005-01-01 0006-01-01
 1206.68 782.45 1187.00 1398.77 1883.23 1431.80

 Nowhere 1980 is coming. Any better suggestion?

 Gabor Grothendieck wrote:

 On Sun, Jun 1, 2008 at 8:47 AM, Gabor Grothendieck
 wrote:
 On Sun, Jun 1, 2008 at 8:35 AM, Megh Dal wrote:
 Hi all,

 I have following monthly time series :

 head(data1)
 V1 V2 V3
 1 Nov-80 NA 1007.44
 2 Dec-80 NA 982.05
 3 Jan-81 NA 994.25
 4 Feb-81 NA 996.31
 5 Mar-81 NA 939.91
 6 Apr-81 NA 923.32

 If the suggestion below does not work then try
 dput(head(data1)) to display it in an unambiguous form that is
 readily re-input into R.


 Now I want to convert it to a 'zoo' object. I wrote following syntax :

 ss = zoo(data1[,3], as.Date(data1[,1], format=%m/%y))


 See ?strptime and try %b-%y

 That should be:

 z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))

 or, if you want it as Date instead of yearmon:

 z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))


 However I got following :
 head(ss)

 1007.44 982.05 994.25 996.31 939.91 923.32


 Can anyone please tell me what will be the correct syntax?

 Thanks



 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.







__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating zoo object on monthly time series

2008-06-01 Thread Megh Dal
Thanks Gabor, I have updated that and it is now working fine

Gabor Grothendieck [EMAIL PROTECTED] wrote: Please upgrade to the latest 
version of zoo.  as.yearmon.factor
was only added to zoo in recent versions and its likely your date
column is a factor.

If that is not the problem then please provide the dput output as
requested.

On Sun, Jun 1, 2008 at 9:59 AM, Megh Dal  wrote:
 packageDescription(zoo)$Version
 [1] 1.1-1


 Gabor Grothendieck  wrote:

 You need to unambiguously specify what your data
 looks like. Please provide the dput output as previously
 requested. Also what version of zoo are you using?

 packageDescription(zoo)$Version


 On Sun, Jun 1, 2008 at 9:37 AM, Megh Dal wrote:
 I got following:

 z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))
 head(z)
 Jan 0001 Jan 0002 Jan 0003 Jan 0004 Jan 0005 Jan 0006
 1206.68 782.45 1187.00 1398.77 1883.23 1431.80

 z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))
 head(z)
 0001-01-01 0002-01-01 0003-01-01 0004-01-01 0005-01-01 0006-01-01
 1206.68 782.45 1187.00 1398.77 1883.23 1431.80

 Nowhere 1980 is coming. Any better suggestion?

 Gabor Grothendieck wrote:

 On Sun, Jun 1, 2008 at 8:47 AM, Gabor Grothendieck
 wrote:
 On Sun, Jun 1, 2008 at 8:35 AM, Megh Dal wrote:
 Hi all,

 I have following monthly time series :

 head(data1)
 V1 V2 V3
 1 Nov-80 NA 1007.44
 2 Dec-80 NA 982.05
 3 Jan-81 NA 994.25
 4 Feb-81 NA 996.31
 5 Mar-81 NA 939.91
 6 Apr-81 NA 923.32

 If the suggestion below does not work then try
 dput(head(data1)) to display it in an unambiguous form that is
 readily re-input into R.


 Now I want to convert it to a 'zoo' object. I wrote following syntax :

 ss = zoo(data1[,3], as.Date(data1[,1], format=%m/%y))


 See ?strptime and try %b-%y

 That should be:

 z - zoo(data1[,3], as.yearmon(data1[,1], %b-%y))

 or, if you want it as Date instead of yearmon:

 z - zoo(data1[,3], as.Date(as.yearmon(data1[,1], %b-%y)))


 However I got following :
 head(ss)

 1007.44 982.05 994.25 996.31 939.91 923.32


 Can anyone please tell me what will be the correct syntax?

 Thanks



 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.








   
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.