[R] Variable operations

Syamsul Rizal rizalsyamsul at gmail.com
Thu Oct 24 06:39:56 CEST 2013


Dear All:

I have

v = c(xy, xy^2, z)

dotv = sum(v*v)

I hope, I have the following result:

dotv = x^2*y^2 + x^2*y^4 + z^2  (still in variable x, y and z, not
numeric result)

How to make simple script, so that I have: dotv = x^2*y^2 + x^2*y^4 + z^2

Thanks a lot for your help.

Best regards, Rizal



More information about the R-help mailing list