Try this modification:
as.yearmon(paste(res[,1], res[,2], sep="-"),format="%Y-%m")Andy

--- On Wed, 9/10/08, Megh Dal <megh700004@yahoo.com> wrote:
From: Megh Dal <megh700004@yahoo.com>
Subject: [R] Woring message in as.yearmon()
To: r-help@stat.math.ethz.ch
Date: Wednesday, September 10, 2008, 2:15 PM

I have following dataset:

> res
      [,1] [,2] [,3]
 [1,] 1946    4 1.27
 [2,] 1946    5 1.27
 [3,] 1946    6 1.27
 [4,] 1946    7 1.27
 [5,] 1946    8 1.52
 [6,] 1946    9 1.52
 [7,] 1946   10 1.52
 [8,] 1946   11 1.52
 [9,] 1946   12 1.62
[10,] 1947    1 1.62
[11,] 1947    2 1.62
[12,] 1947    3 1.62
[13,] 1947    4 1.87
[14,] 1947    5 1.87
[15,] 1947    6 1.87

Now I write following code :

> as.yearmon(paste(res[,1], res[,2], sep="-"))
 [1] "Apr 1946" "May 1946" "Jun 1946" "Jul
1946" "Aug 1946" "Sep 1946" "Oct 1946"
"Nov 1946" "Dec 1946"
[10] "Jan 1947" "Feb 1947" "Mar 1947" "Apr
1947" "May 1947" "Jun 1947"
Warning message:
In if (nch == 1) "%Y-%m" else "%Y-%m-%d" :
  the condition has length > 1 and only the first element will be used

Can anyone please tell me why this warning message is coming and what is the
remedy?

Regards,

______________________________________________
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]]

