hi: it's not clear to me what you're trying to do but maybe outer is what you want ?

outer(x,y)

it takes every value in x and pairs it with every value in y and the default operation is multiply. see details by doing ?outer.



On Wed, Feb 4, 2009 at 10:36 PM, cruz wrote:

Hi,

I compute the value of xi*xj by "for" loops, this how I try:

x1 <- c(1:3)
x2 <- c(2:4)

### to compute x1*x2

(paste("x", 1, sep = ""))*(paste("x", 2, sep = ""))
Error in (paste("x", 1, sep = "")) * (paste("x", 2, sep = "")) :
  non-numeric argument to binary operator


All comments are appreciated.

Thanks,
cruz

______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to