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']
, header=F)
...
}
HTH
Peter Alspach
> -Original Message-
> 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
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 console
3 matches
Mail list logo