Re: [R] Writing a summary file in R

2011-08-03 Thread a217
> > as.data.frame(t(sapply(splinp, function(x) summary(x > $methylation )) ) ) >Min. 1st Qu. Median Mean 3rd Qu. Max. > chr1 100 0.04 0.0425 0.045 0.045 0.0475 0.05 > chr1 200 0.12 0.1200 0.120 0.120 0.1200 0.12 > chr1 500 0.09 0.0900 0.090 0.090 0.090

[R] Counting rows given conditional

2011-08-04 Thread a217
Hello, I have an input file that contains multiple columns, but the column I'm concerned about looks like: "TR" 5 0 4 1 0 2 0 To count all of the rows in the column I know how to do NROW(x$TR) which gives 7. However, I would also like to count only the number of rows with values >=1 (i.e. not 0

[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 console

[R] Generating a histogram with R

2011-07-12 Thread a217
one file? Also, would I be able to generate one histogram from multiple files as well (with the same format)? For example, I have multiple files in the same format as the sample file above, and I would like to make one histogram for all column six data in all files. Thank you, a217 -- View this

[R] Writing a summary file in R

2011-07-27 Thread a217
Hello, I have an input file: http://r.789695.n4.nabble.com/file/n3700031/testOut.txt testOut.txt where col 1 is chromosome, column2 is start of region, column 3 is end of region, column 4 and 5 is base position, column 6 is total reads, column 7 is methylation data, and column 8 is the strand.

Re: [R] Writing a summary file in R

2011-07-27 Thread a217
Yes, that is the general objective. I'll look-into aggregates in R and see if anything helps. Thanks, a217 -- View this message in context: http://r.789695.n4.nabble.com/Writing-a-summary-file-in-R-tp3700031p3700071.html Sent from the R help mailing list archive at Nabbl

Re: [R] Writing a summary file in R

2011-07-27 Thread a217
Thank you both very much! The codes are pretty slick and should greatly help me in my task. -- View this message in context: http://r.789695.n4.nabble.com/Writing-a-summary-file-in-R-tp3700031p3700382.html Sent from the R help mailing list archive at Nabble.com. _

[R] Histogram for each ID value

2011-10-17 Thread a217
I have a dataframe in the general format: chr1 0.5 chr1 0 chr1 0.75 chr2 0 chr2 0 chr3 1 chr3 1 chr3 0.5 chr7 0.75 chr9 1 chr9 1 chr22 0.5 chr22 0.5 where the first column is the chromosome location and the second column is some value. What I'd like to do is have a histogram created for each chr

[R] replacing percentage of values in data frame

2011-10-19 Thread a217
I've been looking for how to change a certain percentage of values in a data frame, but I've been struggling to find information in R. For example: #example data## > data V1V2V3 V4 V5 V6 V7 1 chr1 500 500 CHH 0 0.5 + 2 chr1 550 550 CHH 0

[R] Help with increasing the speed of script

2011-10-27 Thread a217
I actually have two questions regarding the same script: # data <- vector('list', 24) splc <- vector('list',24) df.summ <- vector('list',24) for (i in 1:length(chrData)) { data[[i]] <- read.table(file=paste('chr',i,'.nonCG.covered.out',sep=''), h