On Mon, 23 Dec 2019 17:56:35 +0300 Medic <mailipadp...@gmail.com> wrote:
> I would like to split > mydata$var > by > mydata$group #to get var1 and var2 There is the split() function that does exactly that (except it returns a list instead of multiple variables)... > And then get > summary (var1, var2) #this is my finite aim ...and you can either use lapply() on the list returned by split() or tapply() to both split the dataset into groups and call summary() on each in one expression. See ?tapply and example(tapply) for more info. -- Best regards, Ivan ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.