Thanks... I don't know why I didn't try... guess was in hurry... I apologize for posting such a simple question
On Mon, Sep 16, 2013 at 3:44 PM, Rui Barradas <ruipbarra...@sapo.pt> wrote: > Hello, > > That's an even simpler case for ?split. > > > dat <- read.table(text = " > > id user IP > 1 12 ip1 > 2 12 ip1 > 3 12 ip2 > 4 12 ip2 > 5 12 ip2 > 6 12 ip3 > 7 12 ip3 > 8 12 ip3 > ", header = TRUE) > > split(dat, dat$IP) > > > Hope this helps, > > Rui Barradas > > Em 16-09-2013 22:57, srecko joksimovic escreveu: > >> Hi, >> >> I had an example like this: >> id user action >> 1 12 login >> 2 12 view >> 3 12 view >> 4 12 view >> 5 12 login >> 6 12 view >> 7 12 view >> 8 12 login >> which I used to split using split(dat1,cumsum(dat1$action=**="login")). >> >> If I had a similar example: >> id user IP >> 1 12 ip1 >> 2 12 ip1 >> 3 12 ip2 >> 4 12 ip2 >> 5 12 ip2 >> 6 12 ip3 >> 7 12 ip3 >> 8 12 ip3 >> >> how can I split data frame to obtain the following structure: >> #1 >> 1 12 ip1 >> 2 12 ip1 >> #2 >> 3 12 ip2 >> 4 12 ip2 >> 5 12 ip2 >> #3 >> 6 12 ip3 >> 7 12 ip3 >> 8 12 ip3 >> >> thanks, >> Srecko >> >> [[alternative HTML version deleted]] >> >> ______________________________**________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> >> PLEASE do read the posting guide http://www.R-project.org/** >> posting-guide.html <http://www.R-project.org/posting-guide.html> >> and provide commented, minimal, self-contained, reproducible code. >> >> [[alternative HTML version deleted]] ______________________________________________ R-help@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.