Re: [R] Coding question for behavioral data analysis

2011-08-22 Thread jabroesch
Thank you both for the replies. While neither produced the exact desired results, they spurred some new thinking about how to approach the problem. I came up with a way to get the output desired, but it is probably pretty clunky. I will post it here anyway, in case someone is interested in the futu

Re: [R] Coding question for behavioral data analysis

2011-08-19 Thread jim holtman
You might try using "outer" to create a matrix that will help out: > Time <- c(1000, 1050, 1100, 1500, 2500, 5000, 6500, 6600, 7000) > Time [1] 1000 1050 1100 1500 2500 5000 6500 6600 7000 > ?outer starting httpd help server ... done > x <- outer(Time, Time, FUN = function(a, b){d <- b-a; (d>=0) &

Re: [R] Coding question for behavioral data analysis

2011-08-19 Thread Romain DOUMENC
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, as far as I understood your problem, this function might do the trick: CountNextBehavior <- function (data.source, interest.behavior, lev.ignore, interest.timeframe) { ## -- ## Ret