<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#ffffff">
Dear Rcpp experts, <br>
<br>
I am trying to find a way a single integer to a function. See the
code below. I am here obliged to translage v1 as an IntegerVector
and then to select only its first argument. Is there a better way of
doing this, where I don't have to declare an entire vector for such
a task?<br>
<br>
###########################################<br>
src2 <- '<br>
<b> IntegerVector x1(v1); </b> <br>
IntegerMatrix xD(D);<br>
IntegerVector Drow(xD.ncol()); <br>
for(int i=0; i<xD.ncol(); i++) Drow[i]=xD(<b>x1[0]</b>,i); <br>
return Drow;<br>
'<br>
rowExtraction <-
cxxfunction(signature(D="matrix",v1="integer"),body=src2,plugin="Rcpp",verbose=TRUE)<br>
rowExtraction(D,1)<br>
############################################<br>
<br>
Thank you very much, <br>
Cedric <br>
<br>
<br>
<div class="moz-signature">-- <br>
<div class="moz-signature"><font face="Times" size="3">
Cedric Ginestet <br>
Centre for Neuroimaging Sciences (L3.04) <br>
NIHR Biomedical Research Centre <br>
Department of Neuroimaging <br>
Institute of Psychiatry, Box P089 <br>
King's College London <br>
De Crespigny Park<br>
London <br>
SE5 8AF <br>
Tel: (+44) 20-3228-3052<br>
Fax: (+44) 20-3228-2116<br>
Email: <a class="moz-txt-link-abbreviated"
href="mailto:cedric.ginestet@kcl.ac.uk">cedric.ginestet@kcl.ac.uk</a><br>
</font>
</div>
</div>
</body>
</html>