Re: [R] Compute z

2015-07-28 Thread MacQueen, Don
To which I will add: Start up R. At the prompt, type ?Control This will show you the syntax for 'for' loops. (is this homework?) -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 7/26/15, 8:19 AM, "R-help on behalf of

Re: [R] Compute z

2015-07-26 Thread Jeff Newmiller
sum(v*w) There are no "column vectors" in R... there are vectors (that have no "direction"), and there are data frames that might only have one column, and matrices that might have many rows but only one column, and a piece of matrix or data frame is often converted to a vector when indexing is

Re: [R] Compute z

2015-07-26 Thread Michael Dewey
Dear Hal Are you looking for %*% by any chance? On 26/07/2015 09:38, admin.dslcompu...@gmail.com wrote: Hi Everyone: How do I correctly compute z? z = 0; for i = 1:7 z = z + v(i) * w(i) end If there are two column vectors v and w, each with 7 elements (i.e., they have dimensions 7x1)

[R] Compute z

2015-07-26 Thread admin.dslcomputer
Hi Everyone: How do I correctly compute z? z = 0; for i = 1:7 z = z + v(i) * w(i) end If there are two column vectors v and w, each with 7 elements (i.e., they have dimensions 7x1). Regards, Hal Sent from Surface [[alternative HTML version deleted]] ___