<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'><p abp="5104">Hi to all members of the list,</p><p abp="5104"> </p><p abp="5105">Let's say I have the following data (small example):</p><p abp="5106"> </p><p abp="5106"><font face="Courier New,sans-serif" abp="5230">DT <- data.table(ID=c(1,1,2),<br abp="5231">        start=c("1985-01-01","1993-07-15","1993-05-17"),<br abp="5232">        end=c("1992-05-01","1997-02-01",NA))<br abp="5233"></font></p><p abp="5106">I would want to replace missing values by "01-01-2000" in "end" variable, and convert both "start" and "end" columns in as.Date class. </p><p abp="5106">I tried the code:</p><p abp="5106"> </p><p abp="5106"><font face="Courier New,sans-serif" style="font-size: 12pt;" abp="5235">DT[ , c("start", "end"):=list(as.Date(start,format="%d/%m/%Y",origin="1900-10-01"),</font></p><p abp="5106"><font face="Courier New,sans-serif" style="font-size: 12pt;">as.Date(ifelse(is.na(end),"01/01/2000",end),format="%d/%m/%Y",origin="1900-10-01")), by=ID]</font></p><p abp="5106"><font face="Courier New"></font> </p><p abp="5106"><font face="Courier New,sans-serif" abp="5236">Error in `[.data.table`(DT, , `:=`(c("start", "end"), list(as.Date(start,  : <br abp="5237">  Type of RHS ('double') must match LHS ('character'). </font></p><p abp="5106"> </p><p abp="5106">What I have to change? Am I doing it in a too complicated way?</p><p abp="5106"> </p><p abp="5106">Thanks in advance for any help!!</p><p abp="5106"> </p><p abp="5106"> </p>                                      </div></body>
</html>