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) {
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 wrote:
> Dear falks, here I have written following function :
>
> fn <- Vectori
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) } ) })
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) {
retu
4 matches
Mail list logo