Displaying 1 result from an estimated 1 matches for "mat2list".
Did you mean:
mat2listw
2012 Aug 08
3
Outer product from matrix by row and a vector
...t the matrix into a list using the mefa package, as subsetting the original data appears too complicated. However, if I apply the following code I always get a dimensional error, as the unlist() function is applied to the whole list.
library(mefa)
a<-matrix(c(1:6),ncol=3)
b<-c(1,2,3,4)
a<-mat2list(a,MARGIN=1)
outer(a,b,function(x,y){unlist(a)[1]+unlist(a)[3]/b})
Any idea how to do this more elegantly than a nested for-loop?
Many thanks,
Ingo
[[alternative HTML version deleted]]