Hello, It's not that complicated.
f <- function(index, dat, offset=5){ x <- data.frame(Emp=dat[, index], Hours=dat[, index + offset]) aggregate(Hours~Emp, data=x, sum) } sp <- read.table("supermarkt.txt") lapply(1:5, f, sp) Also, please provide context. (Quote the post you are reffering to.) Hope this helps, Rui Barradas Em 25-06-2012 11:43, faelsendoorn escreveu:
I do now know how to navigate through the table. But my question is, what kind of graphical and numerical summaries can I make with keeping in mind that I am interested in the average working hour per employee? -- View this message in context: http://r.789695.n4.nabble.com/Apply-on-columns-tp4633468p4634411.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.
______________________________________________ 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.