<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'><font color="#0c0c0c" face="Courier New"> <font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font color="#000000"><font face="Calibri">Hello,<o:p></o:p></font></font></p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font color="#000000"><font face="Calibri">I have a list below whose elements are data frames (Please see the
attached file ¡§try.dat¡¨). Now I want to apply a complicated function to
each row of the data frame which returns a single value. For simplicity, you
can assume this function is ma(x) (x is the row of the data frame). </font></font></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font color="#000000"><font face="Calibri"></font></font> </p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;">[[1]]<br> class_id student_id 1 2<br>1 1 1 9 14<br>2 1 2 4 1<br>3 1 3 10 8<br>4 1 4 7 7<br>5 1 5 6 11<br>6 1 6 1 3<br>7 1 7 14 10<br>8 1 8 13 12<br>9 1 9 12 2<br>10 1 10 3 9<br>11 1 11 8 4<br>12 1 12 11 6<br>13 1 13 2 13<br>14 1 14 5 5</p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;">[[2]]<br> class_id student_id 1 2<br>15 2 1 11 3<br>16 2 2 7 10<br>17 2 3 2 2<br>18 2 4 6 6<br>19 2 5 13 8<br>20 2 6 12 13<br>21 2 7 8 14<br>22 2 8 1 9<br>23 2 9 3 1<br>24 2 10 4 11<br>25 2 11 5 4<br>26 2 12 9 12<br>27 2 13 10 7<br>28 2 14 14 5</p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;">[[3]]<br> class_id student_id 1 2<br>29 3 1 12 6<br>30 3 2 1 3<br>31 3 3 8 2<br>32 3 4 9 10<br>33 3 5 11 7<br>34 3 6 14 4<br>35 3 7 2 14<br>36 3 8 13 13<br>37 3 9 3 8<br>38 3 10 5 11<br>39 3 11 4 12<br>40 3 12 7 1<br>41 3 13 10 5<br>42 3 14 6 9</p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> </p><font color="#000000"><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> </p><font face="Calibri"><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font face="Times New Roman">
</font></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> </p></font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> </p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font face="Times New Roman"></font> </p></font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> </p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font color="#000000"><font face="Calibri"><o:p></o:p></font></font> </p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><o:p><font color="#000000" face="Calibri"> </font></o:p></p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font color="#000000"><font face="Calibri">In real situation the list will be very long, and the
dataframe is much wider. That¡¦s why I want to use Rcpp to improve the
speed.<o:p></o:p></font></font></p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><o:p><font color="#000000" face="Calibri"> </font></o:p></p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font color="#000000"><font face="Calibri">I got stuck from the very beginning, I failed to import this
list to Rcpp, not to mention import the dataframe to Rcpp.<o:p></o:p></font></font></p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><o:p><font color="#000000" face="Calibri"> </font></o:p></p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font color="#000000"><font face="Calibri">I¡¦ve checked the book Seamless R and C++ integration with
Rcpp but find NO example deals with such case.<o:p></o:p></font></font></p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><o:p><font color="#000000" face="Calibri"> </font></o:p></p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font color="#000000"><font face="Calibri">Thank you very much for your support!<o:p></o:p></font></font></p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><o:p><font color="#000000" face="Calibri"> </font></o:p></p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font color="#000000"><font face="Calibri">Best regards,<o:p></o:p></font></font></p><font color="#000000" face="Times New Roman">
</font><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><font color="#000000"><font face="Calibri">Sky <o:p></o:p></font></font></p><font color="#000000" face="Times New Roman">
</font><br id="FontBreak"></font> </div></body>
</html>