Re: [R] Constructing the transition pair using loop function and paste()

2011-10-20 Thread Sally Zhen
I got it! Thank you so much Jim! On 20 October 2011 15:06, jim holtman wrote: > try this: You were redfining 'transition' within the loop > > x <- > > c('A','D','F','H','N','A','C','H','F','D','F','F','H','K','G','D','D','B','N','K','O','V','S','S','F','H','J','U','K','T','H','S','R','G','S','R

Re: [R] Constructing the transition pair using loop function and paste()

2011-10-20 Thread jim holtman
Here is another way of getting the lists > newtrans <- lapply(split(mydata, mydata$agents), function(.agent){ + .all <- paste(.agent$actions, collapse = '') + .indx <- embed(seq(nchar(.all)), 2) + substring(.all, .indx[, 2], .indx[, 1]) + }) > > newtrans $`2857` [1] "LB" $`293` [1] "A

Re: [R] Constructing the transition pair using loop function and paste()

2011-10-20 Thread jim holtman
try this: You were redfining 'transition' within the loop x <- c('A','D','F','H','N','A','C','H','F','D','F','F','H','K','G','D','D','B','N','K','O','V','S','S','F','H','J','U','K','T','H','S','R','G','S','R','R','G','D','B','G','F','G','N','H','H','K','L','B','X','C','V','S','F','X','G','T','H',

[R] Constructing the transition pair using loop function and paste()

2011-10-20 Thread Sally Zhen
Hi all, I'd like to thank those who helped me with my previous loop function question with agents/events. I have solved the problem with the advice from this community. I have now moved on to the next step, which requires me to find all the transition pair within an event. A sample data and the