Megh Dal wrote:
Dear falks, here I have written following function :
fn - Vectorize(function(x = 1:3, y = 3:6) {
x - matrix(x, nrow=1)
y - matrix(y, ncol=1)
dat - apply(x, 2, function(xx) {
apply(y, 1, function(yy) {
Dear falks, here I have written following function :
fn - Vectorize(function(x = 1:3, y = 3:6) {
x - matrix(x, nrow=1)
y - matrix(y, ncol=1)
dat - apply(x, 2, function(xx) {
apply(y, 1, function(yy) {
Your arguments are not coming through.
fn - function(x = 1:3, y = 3:6) {
x - matrix(x, nrow=1)
y - matrix(y, ncol=1)
dat - apply(x, 2, function(xx) {
apply(y, 1, function(yy) {
return(xx + yy) } ) })
Hi:
This is shorter:
t(outer(x, y, '+'))
[,1] [,2] [,3]
[1,]456
[2,]567
[3,]678
[4,]789
[5,]89 10
HTH,
Dennis
On Wed, Jun 2, 2010 at 2:25 AM, Megh Dal megh700...@yahoo.com wrote:
Dear falks, here I have written following function
4 matches
Mail list logo