<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FR" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi, <br>
<br>
I have updated data.table package to 1.9.2 recently from 1.8.10 and I found errors on my previous code.
<br>
<br>
See reproductible example below: <br>
<br>
On 1.8.10 :<br>
DT<-data.table(X=factor(2006:2012),Y=rep(1:7,2))<br>
DT[,Z:=paste(X,.N,sep=" - "),by=list(X)][]<br>
<br>
X Y Z<br>
1: 2006 1 2006 - 2<br>
2: 2007 2 2007 - 2<br>
3: 2008 3 2008 - 2<br>
4: 2009 4 2009 - 2<br>
5: 2010 5 2010 - 2<br>
6: 2011 6 2011 - 2<br>
7: 2012 7 2012 - 2<br>
8: 2006 1 2006 - 2<br>
9: 2007 2 2007 - 2<br>
10: 2008 3 2008 - 2<br>
11: 2009 4 2009 - 2<br>
12: 2010 5 2010 - 2<br>
13: 2011 6 2011 - 2<br>
14: 2012 7 2012 - 2<br>
<br>
In column Z, I get the level of the factor column X <br>
pasted with count '.N' as expected<br>
<br>
However, in the 1.9.2, with same code :<br>
DT<-data.table(X=factor(2006:2012),Y=rep(1:7,2))<br>
DT[,Z:=paste(X,.N,sep=" - "),by=list(X)][]<br>
<br>
X Y Z<br>
1: 2006 1 1 - 2<br>
2: 2007 2 2 - 2<br>
3: 2008 3 3 - 2<br>
4: 2009 4 4 - 2<br>
5: 2010 5 5 - 2<br>
6: 2011 6 6 - 2<br>
7: 2012 7 7 - 2<br>
8: 2006 1 1 - 2<br>
9: 2007 2 2 - 2<br>
10: 2008 3 3 - 2<br>
11: 2009 4 4 - 2<br>
12: 2010 5 5 - 2<br>
13: 2011 6 6 - 2<br>
14: 2012 7 7 - 2<br>
<br>
as results, I do not get levels of factor column X but the numeric values associated with the level.
<br>
<br>
is this working normally? Why has it changed? Is that a bug? <br>
<br>
I use this kind of procedure to make labels for ggplot. All my previous code is not working anymore. It's kind of annoying.<br>
<br>
</span>Thanks<br>
<br>
Christophe<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>