Re: [R] Loops for repetitive task

2011-08-10 Thread Dennis Murphy
Hi: Try this: ## Function that takes a data frame as input and outputs a data frame: chrSumm - function(d) { # d is a data frame colnames(d) - c(chr,start,end,base1,base2, totalreads,methylation,strand) TR - nrow(d) RG1 - sum(d['totalreads'] = 1) percent -

[R] Loops for repetitive task

2011-08-09 Thread a217
Hello, I have an R script that I use as a template to perform a task for multiple files (in this case, multiple chromosomes). What I would like to do is to utilize a simple loop to parse through each chromosome number so that I don't have to type the same code over and over again in the R

Re: [R] Loops for repetitive task

2011-08-09 Thread Peter Alspach
- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of a217 Sent: Wednesday, 10 August 2011 4:32 p.m. To: r-help@r-project.org Subject: [R] Loops for repetitive task Hello, I have an R script that I use as a template to perform a task for multiple files