Re: [R] nested for loop with data table

2017-05-06 Thread Ek Esawi
Thank you Jeff. Your idea, as i mentioned on my previous posting, did indeed work. I read somewhere that both data table dplyr do great many things and i plan to learn both as much as i can. Suggestions on this list either get you the answer you are looking for or give you lead to an answer. Thank

Re: [R] nested for loop with data table

2017-05-03 Thread PIKAL Petr
) A B C D E F 3 1 1 0 1 1 It is probably preferable to obtain logical vectors for Num and Day before starting tabulation. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ek Esawi > Sent: Wednesday, May 3, 2017 5:17 PM > To: r-help

Re: [R] nested for loop with data table

2017-05-03 Thread Jeff Newmiller
You seem to be unaware of the "aggregate" data processing concept. There are many ways to accomplish aggregation, but I am not fluent in data.table methods but knowing the concept is the first step. Perhaps look closely at [1], or Google for data table aggregation yourself? [1] https://www.r-

Re: [R] nested for loop with data table

2017-05-03 Thread Ek Esawi
Thank you both Boris and Jim. Thank you, Boris, for advising to read the posting guide; I had and I just did. Jim’s idea is exactly what I want; however, I could not pass sset1, sset2, etc. to the j nested loop and collect the results in an vector. Here attached my code, file, and my question whi

Re: [R] nested for loop with data table

2017-05-02 Thread Jim Lemon
Hi Ek, I think you want your example to look like this: Sample<-read.table(text= "Num Color Grade Value Month Day 1 yellow A 20 May 1 2 green B 25 June 2 3 green A 10 April 3 4 black A 17 August 3 5 red C 5 December 5 6 orange D 0 January 13 7 orange E 12 January 5 8 orange F 11 February 8 9 orang

Re: [R] nested for loop with data table

2017-05-02 Thread Boris Steipe
There's a lot that doesn't make sense here. I think what you need to do is produce a small, reproducible example, post that with dput() and state your question more clearly - including what you have tried and what didn't work. You'll probably be amazed how quickly you will get good advice if _y