Hi,
a have some code like
myfunc - function(x) { ...; return c(a,b) }
ys - sapply(0:100,myfunc)
so I get something like c(c(a1,b1),c(a2,b2),...)
But now I need the as and bs in one vector
as - apply(ys, function(c(a,b)) a)
bs - apply(ys, function(c(a,b)) b)
Can you help me with the
This would be a whole lot easier if we had a reproducible example,
or at least knew what your output data actually looked like, and an
example of what you *wanted* it to look like.
For instance, I'm confused by your description of your output data:
c(c(1,2), c(3,4))
[1] 1 2 3 4
c(c(), c()) is a
Am 09-12-2011 12:54, schrieb Sarah Goslee:
myfunc- function(x) {a=x; b=x-1; c(a, b) }
ys- sapply(1:5, myfunc)
ys
[,1] [,2] [,3] [,4] [,5]
[1,]12345
[2,]01234
And from there, it's not at all clear what you mean by one vector -
in what order?
3 matches
Mail list logo