[R] assessing data variation

Chuck Cleland ccleland at optonline.net
Fri Jul 10 11:33:36 CEST 2009


On 7/10/2009 5:21 AM, e-letter wrote:
> I have data like so:
> 
> time	datum
> 30	12
> 60	24
> 90	37
> 120	41
> 150	8
> 
> In addition to standard deviation, I want to measure the average of
> the differences in data for each time interval, i.e. average of 24-12,
> 37-24, 41-37, 8-41. Is there a statistical term for this task? Which
> package should I use please?

  I don't know a term for it, but you might try something like this:

mydf <- data.frame(time = c(30,60,90,120,150),
                   datum = c(12,24,37,41,8))

diff(mydf$datum)
[1]  12  13   4 -33

mean(abs(diff(mydf$datum)))
[1] 15.5

?diff

> rhelp at conference.jabber.org
> 
> ______________________________________________
> 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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list