Re: [R] scoping issues?

From: Barry Rowlingson <>
Date: Fri 09 Dec 2005 - 05:38:42 EST

tom wright wrote:

 > Browse[1]> mean(amps[1],amps[2],amps[3],amps[7],amps[8])  > [1] 1

  For starters, this just returns mean(amps[1]). 'mean' computes the mean of the first argument, the others are slurped up by '...' and in this case thrown into the bin. You want to do mean(c(amps[1],amps[2],amps[3] and so on. Wrap them into a single vector.

  For main course, I think you can do it like this:

getAR <- function(v.amps){


  An example input/output would be nice. My code gives:

> amps<-c(1,2,3,3,3,2,1)
> getAR(amps)
  [1] 1.454545

  but I still dont know if that's what it should be!

  For dessert, I don't think its a scoping issue, I think you've not really explained what the problem is...

Baz mailing list PLEASE do read the posting guide! Received on Fri Dec 09 06:06:30 2005

This archive was generated by hypermail 2.1.8 : Fri 09 Dec 2005 - 09:31:26 EST