Displaying 2 results from an estimated 2 matches for "vecout".
Did you mean:
vecot
2010 Mar 25
1
Error using Rcpp
...code that takes in a vector and adds 1 to each element:
#include <Rcpp.h>
// This file takes in a vector and adds one to each entry
RcppExport SEXP addone(SEXP vec){
// create a local copy of vec
Rcpp::NumericVector orig(vec);
// create an output vector
Rcpp::NumericVector vecout(orig.size());
for(i=0;i<orig.size();i++) {
vecout[i] = orig[i]+1;
}
Rcpp::Pairlist
res(Rcpp::Named("result",vecout),Rcpp::Named("original",orig));
return res;
}
I then try to use - R CMD SHLIB addone.cpp
that didnt work. the error said there was n...
2013 Sep 05
2
binary symmetric matrix combination
...e5 1 0 0 0 0 0 0 0 0 1
l15 1 0 0 0 0 0 0 0 1 0",sep="",header=TRUE))
names1<-unique(c(colnames(m1),colnames(m2),colnames(m3),colnames(m4)))
Out2<-matrix(0,length(names1),length(names1),dimnames=list(names1,names1))
vec1<- paste0(colnames(m1)[col(m1)],rownames(m1)[row(m1)])
vecOut<- paste0(colnames(Out2)[col(Out2)],rownames(Out2)[row(Out2)])
Out2[match(vec1,vecOut)]<- m1
vec2<- paste0(colnames(m2)[col(m2)],rownames(m2)[row(m2)])
Out2[match(vec2,vecOut)]<- m2
vec3<- paste0(colnames(m3)[col(m3)],rownames(m3)[row(m3)])
Out2[match(vec3,vecOut)]<- m3
vec4<- p...