search for: exampleby

Displaying 1 result from an estimated 1 matches for "exampleby".

Did you mean: exampleb
2012 Jan 10
1
Converting BY to a data.frame
Hello, I am trying to convert BY to a data frame, consider the following example: exampleDF<-data.frame(a=c(1,2),b=c(10,20),name=c("first","second")) exampleBY<-by(exampleDF,with(exampleDF,paste(a,b,sep="_")),               function(x) {                 data.frame(                     name=as.character(x$name),                     a=x$a,                     b=x$b,                     c=x$a + x$b)               }         ) I made this functi...