Skip to content

non-numeric argument to binary operator

2 messages · cruz, Bill Venables

#
Hi,

I compute the value of xi*xj by "for" loops, this how I try:
### to compute x1*x2
Error in (paste("x", 1, sep = "")) * (paste("x", 2, sep = "")) :
  non-numeric argument to binary operator
All comments are appreciated.

Thanks,
cruz
#
You are making difficulties where there are none.  Consider
[1]  2  6 12
[,1] [,2] [,3]
[1,]    2    3    4
[2,]    4    6    8
[3,]    6    9   12
[,1]
[1,]   20
It's probably best if you start learning R by reading the introductory material and trying it out. If the going gets tough, persevere. Trying to learn R directly from R-help can get a bit tedious (on both sides).

Bill Venables
http://www.cmis.csiro.au/bill.venables/ 


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of cruz
Sent: Thursday, 5 February 2009 1:36 PM
To: r-help at r-project.org
Subject: [R] non-numeric argument to binary operator

Hi,

I compute the value of xi*xj by "for" loops, this how I try:
### to compute x1*x2
Error in (paste("x", 1, sep = "")) * (paste("x", 2, sep = "")) :
  non-numeric argument to binary operator
All comments are appreciated.

Thanks,
cruz

______________________________________________
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.