[R] "unbind" matrix?
Bert Gunter
gunter.berton at gene.com
Thu Mar 18 16:44:55 CET 2010
Convert your matrix to a data frame and use do.call().
?do.call
do.call(Myfunc, data.frame(yourMatrix))
You need to do the data frame conversion because do.call wants the arguments
as a list and a data frame **is** a list (the columns are the list members)
with a dim attribute (+ others).
Bert Gunter
Genentech Nonclinical Biostatistics
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of ManInMoon
Sent: Thursday, March 18, 2010 5:39 AM
To: r-help at r-project.org
Subject: [R] "unbind" matrix?
I have a function that take a variable number of arguments, each of which
must be a vector.
Is there a way to "unbind" a matrix that would pass the columns as vectors?
Myfunc<-function(...) {
[My code]
}
Myfunc(z[,1],z[,2]) works
but Myfunc(z[,1:2]) is passing a submatrix
Is there something like Myfunc(unbind(z[,1:2])) ??
--
View this message in context:
http://n4.nabble.com/unbind-matrix-tp1597887p1597887.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list