<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hello everyone,<BR> <BR>I can execute my R code but I obtain a warning message and I do not know how to avoid it.<br>Let's consider, just by way of example, the following data table with 2 subjects under study:<BR> <BR>DT <- data.table(id=c(2,2,2,11,11),<BR> start=c(rep(as.Date("2007-01-01"),3),rep(as.Date("2010-09-30"),2)),<br> visit=c("2007-03-01","2008-07-15","2008-11-17","2010-10-15","2011-05-17"),<br> end=c(rep(as.Date("2009-05-01"),3),rep(as.Date("2012-03-25"),2)))<BR> <BR>I get a new data table which assigns a fictitious visit on each 31 December between<br>the dates "start" and "end" corresponding to each individual:<BR> <BR>DT.new <- unique(DT[,list(start,<br> visit=as.Date(c(paste0(year(start[1]):(year(end[1])-1),"-12-31"))), <br> end), by=id])<BR> <BR>Warning messages:<BR>In `[.data.table`(DT, , list(start, visit = as.Date(c(paste0(year(start[1]):(year(end[1]) - :<br> Column 2 of result for group 1 is length 2 but the longest column in this result is 3. Recycled leaving remainder of 1 items. This warning is once only for the first group with this issue.<BR> <BR>The R code works, but how can I avoid the warning?<BR> <BR>Many thanks for any suggestion!!<BR> </div></body>
</html>