[R] Woring message in as.yearmon()

Megh Dal megh700004 at yahoo.com
Wed Sep 10 20:15:45 CEST 2008


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,



More information about the R-help mailing list