search for: result_1

Displaying 2 results from an estimated 2 matches for "result_1".

Did you mean: result_r
2012 Mar 16
2
how to speed up the inefficient code
...---------------------------------------------------------------------------------------- p<-data.frame(a=rnorm(10),b=rnorm(10),c=rnorm(10),d=rnorm(10)) test<-data.frame(a=rnorm(1),b=rnorm(1),c=rnorm(1),d=rnorm(1)) result<-list() for(i in 1:nrow(p)){ result[[i]]<-sum((p[i,]-test)^2) } result_1<-unlist(result) p_1<-cbind(p,result_1) ------------------------------------------------------------------------------------------------------- is there any efficient way to shorten the time and make same output? -- View this message in context: http://r.789695.n4.nabble.com/how-to-speed-...
2010 Oct 27
2
must .Call C functions return SEXP?
For using R's .Call interface to C functions, all the examples I've seen have the C function return type SEXP. Why? What does R actually do with this return type? What happens if I *don't* return a SEXP? Reason I ask, is I've written some R code which allocates two long lists, and then calls a C function with .Call. My C code writes to those two pre-allocated lists, thus, I