[R] Feed rle() output to hist()

2013-03-26 Thread Newbie1234
I want to make a histogram from the lengths vector which is part of the output of rle. But I don't know how to access that vector so that I use it as an argument of hist(). What argument must I use so that I use the lengths vector as an input to hist()? Example output is: Run Length Encoding

Re: [R] Newbie code to count runs of up or down moves

2013-03-26 Thread Newbie1234
Petr, Thanks. Wow! So little code for something that would require at least two nested loops in C. Now I need to extract the output of rle() and feed it to hist() if I want to draw a histogram (which I do). Can you give me any comments on that? N -- View this message in context: http://

Re: [R] Newbie code to count runs of up or down moves

2013-03-25 Thread Newbie1234
I hope this text does not come out unreadable as before. It is readable in R Studio.. What I am trying to do is take a time-series of prices and create a histogram of the run lengths, where a run is a sequence of all up moves or all down moves. Arun of length k is sequence of k moves all in th

Re: [R] Newbie code to count runs of up or down moves

2013-03-25 Thread Newbie1234
My apologies, I didn't realize checking HTML format would produce unreadable text. WIll repost after some more thought to the problem. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/Newbie-code-to-count-runs-of-up-or-down-moves-tp4662423p4662431.html Sent from the R

[R] Newbie code to count runs of up or down moves

2013-03-25 Thread Newbie1234
There are probably many mistakes with this code. I am used to coding in C with a debugger, so I am very new to coding in R without one and different syntax. My code in the upper left panel of R Studio isz<-c(3,1,4,5,2,1,0,3,5,8)zlength(z)y<-c(0,0,0,0,0,0,0,0,0,0)ylength(y)zdiff = diff(z)zdiffn<-le