[R] Help modifying "aheatmap" or find a new heatmap package
I am currently using "aheatmap" which is generating heatmaps based on Pearson correlation. My data consists of RPKM values for genes from 2 groups. Each group has about 70 samples. Is there anyway that I can modify "aheatmap" so that it generates heat maps based on the actual input values (RPKM) and not Pearson correlation? I want the heatmap to show high heat for higher RPKM and cold heat for lower RPKM. If not, is there a package out there that can do this? Michael [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 modifying "aheatmap" or find a new heatmap package
I am currently using "aheatmap" which is generating heatmaps based on Pearson correlation. My data consists of RPKM values for genes from 2 groups. Each group has about 70 samples. Is there anyway that I can modify "aheatmap" so that it generates heat maps based on the actual input values (RPKM) and not Pearson correlation? I want the heatmap to show high heat for higher RPKM and cold heat for lower RPKM. If not, is there a package out there that can do this? Michael [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] pairs: adjusting margins and labeling axes
I want to make this as easy as possible. The extra space could just go around the plot in the margin area. I could then use a cropping tool to paste the plot into Excel or Word. I'm not opposed to using another package, but I'd need some kind of pre-existing code to tinker with. On Tue, Jul 19, 2016 at 11:16 AM, Greg Snow <538...@gmail.com> wrote: > If you want square plots on a rectangular plotting region, then where > do you want the extra space to go? > > One option would be to add outer margins to use up the extra space. > The calculations to figure out exactly how much space to put in the > outer margins will probably not be trivial. > > Another option would be to not use `pairs`, but use the `layout` > function directly and loops to do your plots (and use the `respect` > argument to `layout`). > > On Tue, Jul 19, 2016 at 11:29 AM, michael young > <nutnutnutter...@gmail.com> wrote: > > The default shape for this correlation scatterplot is rectangle. I > changed > > it to square, but then the x-axis spacing between squares are off. Is > > there an easy way to change x-axis spacing between squares to that of the > > y-axis spacing size? > > > > I decided to hide the name values of the diagonal squares. I want them > > along the x and y axis instead, outside of the fixed number scale I have. > > I haven't seen any online example of 'pairs' with this and all my > searches > > have yielded nothing. Any ideas? Thanks > > > > par(pty="s") > > panel.cor <- function(x, y, digits = 2, prefix="", cex.cor, ...) > > { > > usr <- par("usr"); on.exit(par(usr)) > > par(usr = c(0, 1, 0, 1),xlog=FALSE,ylog=FALSE) > > # correlation coefficient > > r <- cor(x, y) > > txt <- format(c(r, 0.123456789), digits = digits)[1] > > txt <- paste("r= ", txt, sep = "") > > if(missing(cex.cor)) cex.cor <- 0.8/strwidth(txt) > > text(0.5, 0.6, txt, cex=cex.cor * r) > > > > # p-value calculation > > p <- cor.test(x, y)$p.value > > txt2 <- format(c(p, 0.123456789), digits = digits)[1] > > txt2 <- paste("p= ", txt2, sep = "") > > if(p<0.01) txt2 <- paste("p= ", "<0.01", sep = "") > > text(0.5, 0.4, txt2) > > } > > > > pairs(iris, upper.panel = panel.cor,xlim=c(0.1,10), > > ylim=c(0.1,10),log="xy",text.panel = NULL,pch=".") > > > > [[alternative HTML version deleted]] > > > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > > > -- > Gregory (Greg) L. Snow Ph.D. > 538...@gmail.com > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] pairs: adjusting margins and labeling axes
The default shape for this correlation scatterplot is rectangle. I changed it to square, but then the x-axis spacing between squares are off. Is there an easy way to change x-axis spacing between squares to that of the y-axis spacing size? I decided to hide the name values of the diagonal squares. I want them along the x and y axis instead, outside of the fixed number scale I have. I haven't seen any online example of 'pairs' with this and all my searches have yielded nothing. Any ideas? Thanks par(pty="s") panel.cor <- function(x, y, digits = 2, prefix="", cex.cor, ...) { usr <- par("usr"); on.exit(par(usr)) par(usr = c(0, 1, 0, 1),xlog=FALSE,ylog=FALSE) # correlation coefficient r <- cor(x, y) txt <- format(c(r, 0.123456789), digits = digits)[1] txt <- paste("r= ", txt, sep = "") if(missing(cex.cor)) cex.cor <- 0.8/strwidth(txt) text(0.5, 0.6, txt, cex=cex.cor * r) # p-value calculation p <- cor.test(x, y)$p.value txt2 <- format(c(p, 0.123456789), digits = digits)[1] txt2 <- paste("p= ", txt2, sep = "") if(p<0.01) txt2 <- paste("p= ", "<0.01", sep = "") text(0.5, 0.4, txt2) } pairs(iris, upper.panel = panel.cor,xlim=c(0.1,10), ylim=c(0.1,10),log="xy",text.panel = NULL,pch=".") [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Assigning a new name to object loaded with load()
Another method, similar to William's. x - 3 save(x,file=test.Rdata) x - 4 y - local({ load(test.Rdata) stopifnot(length(ls())==1) environment()[[ls()]] }) On Fri, Jul 27, 2012 at 3:53 PM, Rolf Turner rolf.tur...@xtra.co.nz wrote: On 28/07/12 06:59, Alireza Mahani wrote: I would like to load a binary file into R using load(), and then assign a new name to it, regardless of the name it was saved under. Can you please provide a code sample? Thank you! Ummm, what is the antecedent of the pronoun it in the forgoing? The structure of your sentence makes it sound like it refers to ***the binary file*** --- but I don't believe that's what you mean. If you by it you mean an object (the object? one of the objects?) in the saved binary file, then something like: y - x rm(x) should do what you want. Distinguish the container from the thing(s) contained. cheers, Rolf Turner __ 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.
Re: [R] density
I can't help you decide which bandwidth method to use, but here's how you view the density source code... methods(density) density.default On Wed, Jul 25, 2012 at 5:56 PM, li li hannah@gmail.com wrote: Hi all, I have a question regarding the density function which gives the kernel density estimator. I want to decide the bandwidth when using gaussian kernel, given a set of observations. I am not familiar with different methods for bandwidth determination. Below are the different ways in R on deciding the bandwidth. Can anyone give an idea on which ones are preferred. Also, how can I take a look at the source code for the density function? Thank you very much. Hannah x - rnorm(1000) bw.nrd(x) [1] 0.2688588 bw.nrd0(x) [1] 0.2282763 bw.ucv(x) [1] 0.2112366 bw.bcv(x) [1] 0.2890085 Warning message: In bw.bcv(x) : minimum occurred at one end of the range bw.SJ(x) [1] 0.2716242 density(x, give.Rkern=T, kernel=gaussian) [1] 0.2820948 density(x, kernel=gaussian) Call: density.default(x = x, kernel = gaussian) Data: x (1000 obs.); Bandwidth 'bw' = 0.2283 x y Min. :-3.974672 Min. :0.199 1st Qu.:-1.987712 1st Qu.:0.0076405 Median :-0.000752 Median :0.0529498 Mean :-0.000752 Mean :0.1256971 3rd Qu.: 1.986208 3rd Qu.:0.2552411 Max. : 3.973168 Max. :0.3883532 [[alternative HTML version deleted]] __ 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.
[R] Negating two identical characters with regular expressions
Hello all, Let's say I have a character string Race-ethnicity-coding information I want to extract all text before the multiple dashes, including the word ethnicity. I wrote a handy function to extract the first matched text: grepcut - function(pattern,x){ start.and.length - regexpr(pattern,x) substring(x,start.and.length,start.and.length +attr(start.and.length,match.length)-1)} grepcut(^[^-]+,Race-ethnicity-coding information) The above grepcut, of course, returns only the string Race What I really want is a to create a class of two dashes in a row and then negate that. Is it possible to create a class of repeated characters? If so, it might be further complicated that - is a special character in brackets and can only go first or last. Can anyone help me out? Thanks, Michael Young [[alternative HTML version deleted]] __ 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.