[R] Tracing the top border of a histogram

2013-08-01 Thread Levi Waldron
I want to represent a histogram by the line along its top border, *without* kernel smoothing (to show several histograms in the same plot). This works, but is there simpler recommended way? x - rnorm(1000) tmp - hist(x, border=white) for (i in 1:(length(tmp$breaks)-1)){

Re: [R] Tracing the top border of a histogram

2013-08-01 Thread Levi Waldron
Very nice - thank you, I didn't know about type='s'. On Thu, Aug 1, 2013 at 3:43 PM, Greg Snow 538...@gmail.com wrote: lines( tmp$breaks, c(tmp$counts,tail(tmp$counts,1)), type='s', col='#00ff0077', lwd=5 ) On Thu, Aug 1, 2013 at 1:30 PM, Levi Waldron lwaldron.resea...@gmail.comwrote

Re: [R] Regularized Regressions

2013-04-17 Thread Levi Waldron
Perhaps I am wrong, but I think there are only a few packages supporting Elastic Net, and none of them also perform Best Subsets. On Wed, Apr 17, 2013 at 8:46 AM, Christos Giannoulis cgiann...@gmail.comwrote: Merhaba, Hello to you too Mehmet (Yasu ki sena) Thank you for your email and

Re: [R] text command - how to get a white background to cover grid lines

2012-09-06 Thread Levi Waldron
For posterity, I found the TeachingDemos::shadowtext option most agreeable for this problem: * legend puts a large box around the text which did not seem possible to shrink, and does not accept vector x, y arguments * plotrix::boxed.labels did not work with pos=4 (this moved the text, but

[R] highlighting clusters in a heatmap

2011-06-30 Thread Levi Waldron
I would like to draw horizontal or vertical lines on a heatmap to highlight the clusters at some specified cut depth of the dendrogram. As a hacked example, the following code would work if I could set the coordinates of the top and bottom of the false color image correctly (ymin and ymax), but

[R] difference between the meaning of MARGIN in sweep() and apply()

2009-12-16 Thread Levi Waldron
Is there a logic to this difference, or is it just a quirk of the history of these functions? I found one discussion on this topic, but without what I thought was a very conclusive end: http://finzi.psych.upenn.edu/Rhelp08/2009-March/191930.html -- Levi Waldron post-doctoral fellow Jurisica Lab

Re: [R] Simple question about error on CSV import

2009-09-01 Thread Levi Waldron
://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling Biology TMDT 9-304D 101 College Street Toronto, Ontario M5G 1L7 (416)581-7453

Re: [R] Two way joining vs heatmap

2009-08-31 Thread Levi Waldron
__ 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. -- Levi Waldron post-doctoral fellow Jurisica Lab

Re: [R] setting par(srt) according to plot aspect ratio

2009-08-28 Thread Levi Waldron
() #as per example code par(mfrow=c(2,1)) makeplot() makeplot() par(mfrow=c(1,2)) makeplot() makeplot() dev.off() -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling Biology TMDT 9-304D 101 College Street Toronto, Ontario M5G 1L7 (416)581-7453

[R] setting par(srt) according to plot aspect ratio

2009-08-27 Thread Levi Waldron
(xpos),label=y=x,pos=3) par(srt=g_angle) text(xpos,g(xpos),label=y=2x,pos=3) -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling Biology TMDT 9-304D 101 College Street Toronto, Ontario M5G 1L7 (416)581-7453 [[alternative HTML version deleted

Re: [R] setting par(srt) according to plot aspect ratio

2009-08-27 Thread Levi Waldron
then gets you to ?plot (actually plot.default() ) Bert Gunter Genentech Nonclinical Biostatisics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Levi Waldron Sent: Thursday, August 27, 2009 1:54 PM To: r-help@r-project.org Subject

Re: [R] setting par(srt) according to plot aspect ratio

2009-08-27 Thread Levi Waldron
) -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling Biology TMDT 9-304D 101 College Street Toronto, Ontario M5G 1L7 (416)581-7453 [[alternative HTML version deleted]] __ R-help@r-project.org mailing

[R] multiple annotations on a heatmap

2009-04-02 Thread Levi Waldron
like to put all three annotations on the heatmap by putting three rows of +/- values between the top of the heatmap and the dendrogram, or even three colored bars. Specific or general suggestions would be welcome. Thank you, Levi -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario

Re: [R] memory space

2009-03-18 Thread Levi Waldron
Perhaps: gc() On Wed, Mar 18, 2009 at 8:26 AM, Abelian abelian1...@gmail.com wrote: Dear all when the program is runing, we can realize that the memory size will be asked more and more.. Therefore, we could meet the significant problem, such as out off memory size. However, even if i

Re: [R] Difficulty Replacing a Row of a Data Frame

2009-03-17 Thread Levi Waldron
Your first example that works would just repeat the atomic vector to the length of the row. To replace a row with another data frame, you could use rbind: avGain - rbind(avGain[-j,],b) Or if the positioning is important, 2) avGain - rbind(avGain[1:(j-1),],b,avGain[(j+1):nrow(avGain),]) I

[R] breaking ties in order() based on many vectors

2009-03-17 Thread Levi Waldron
()? -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling Biology IBM Life Sciences Discovery Centre TMDT 9-304D 101 College Street Toronto, Ontario M5G 1L7 [[alternative HTML version deleted]] __ R

Re: [R] breaking ties in order() based on many vectors

2009-03-17 Thread Levi Waldron
On Tue, Mar 17, 2009 at 12:56 PM, Patrick Burns pbu...@pburns.seanet.comwrote: Use 'do.call' as discussed in 'The R Inferno' and elsewhere. Perfect, thanks. -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling Biology IBM Life Sciences Discovery

Re: [R] Difficulty Replacing a Row of a Data Frame

2009-03-17 Thread Levi Waldron
it sounds like you've figured out. cheers, Levi -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling Biology IBM Life Sciences Discovery Centre TMDT 9-304D 101 College Street Toronto, Ontario M5G 1L7 [[alternative HTML version deleted

[R] getting all pairwise combinations of elements in a character string

2009-02-12 Thread Levi Waldron
=))) a1 a2 a3 a4 b1 b2 b3 c1 c2d ab ac ad ae bc bd be cd ce de -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling Biology IBM Life Sciences Discovery Centre TMDT 9-304D 101 College Street Toronto, Ontario M5G 1L7

Re: [R] getting all pairwise combinations of elements in a character string

2009-02-12 Thread Levi Waldron
I like both of these solutions much better - thank you! -Levi -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling Biology IBM Life Sciences Discovery Centre TMDT 9-304D 101 College Street Toronto, Ontario M5G 1L7

Re: [R] Looping multiple output values to dataframe

2009-02-12 Thread Levi Waldron
) - c(ResultA, ResultB, ResultC) return(results) } variables - sapply(filenames,docalc) -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling Biology IBM Life Sciences Discovery Centre TMDT 9-304D 101 College Street Toronto, Ontario M5G 1L7 (416)581

[R] cumulative sum of within levels of a dataframe

2008-06-27 Thread Levi Waldron
This one should be easy but it's giving me a hard time mostly because tapply puts the results in a list. I want to calculate the cumulative sum of a variable in a dataframe, but with the accumulation only within each level of a factor. For a very simple example, take: df -

Re: [R] cumulative sum of within levels of a dataframe

2008-06-27 Thread Levi Waldron
Perfect, thanks all. Unlist and ave will both be very handy functions to know. -levi -- Levi Waldron, PhD Treated Wood Research Group Faculty of Forestry, University of Toronto 33 Willcocks Street, Toronto ON, M5S 3B3 CANADA Tel 647-866-5384 Fax 416-978-3834 [[alternative HTML

Re: [R] choosing an appropriate linear model

2008-06-06 Thread Levi Waldron
a bootstrap method, or something else? ps. the data is attached to the end of this email. On Thu, Jun 5, 2008 at 6:25 PM, Levi Waldron [EMAIL PROTECTED] wrote: I am trying to model the observed leaching of wood preservative chemicals from treated wood during an outdoor experiment where leaching

[R] lw in legend also changes thickness of characters in the legend??

2008-05-14 Thread Levi Waldron
Here's a simple example: x - 1:5 plot(x,x^2) lines(x,x^2) points(x,x,cex=2) lines(x,x,lw=3) legend(topleft,legend=c(y=x^2,y=x),pch=1,pt.cex=1:2,lw=c(1,3)) The thickness of the circles in the legend changes with lw. If you change the lw argument in legend to lw=c(1,1) then the thickness of the

[R] customization of pairwise comparison plots

2008-05-01 Thread Levi Waldron
I am wondering how to customize a pairwise comparisons plot of a factorial ANOVA, without doing a lot of manual manipulation of a TukeyHSD object. The customizations I'd like are: 1. The aov used log-transformed response data, but I'd like to plot the intervals on their original, untransformed

[R] restricting pairwise comparisons of interaction effects

2008-04-28 Thread Levi Waldron
I'm interested in restricting the pairwise comparisons of interaction effects in a multi-way factorial ANOVA, because I find comparisons of interactions between all different variables different to interpret. For example (supposing a p0.10 cutoff just to be able to use this example): summary(fm1

[R] adding device size-independent y=0 line to a lattice plot

2008-03-31 Thread Levi Waldron
Using the following lattice plot as an example, I would like to add horizontal lines where y=0: library(lattice) library(grid) fac - gl(4,12) x - letters[rep(1:3,16)] y - runif(48,min=0.0) dotplot(y~x|fac) I've tried it with grid.lines using npc and native units, which works fine unless I change

Re: [R] spreading out a numeric vector

2008-03-24 Thread Levi Waldron
*Thank you* Greg, this function works perfectly! I had imagined that the ideal solution would iteratively modify the vector to fix new violations of mindiff created by each subsequent spreading of tight clusters, but couldn't figure how to do it. A small note, the vector x must be sorted before

Re: [R] spreading out a numeric vector

2008-03-24 Thread Levi Waldron
Would this function be worth submitting to some existing cran library? I'd be willing to document it and add error-checking if there is somewhere that it belongs (with credit to Greg of course, unless Greg wants to submit it himself). I am using it in conjunction with a function I wrote which

[R] spreading out a numeric vector

2008-03-22 Thread Levi Waldron
I am creating a timeline plot, but running into a problem in positions where the values to plot are too close together to print the text without overlap. The simplest way I can think of to solve this (although there may be other ways?) is to create a new numeric vector whose values are as close

Re: [R] spreading out a numeric vector

2008-03-22 Thread Levi Waldron
On Sat, Mar 22, 2008 at 9:58 PM, jim holtman [EMAIL PROTECTED] wrote: Is this close to what you want? spread - function(x, mindiff=0.5){ + unique(as.integer(x / mindiff) * mindiff) + } x - c(1,2,seq(2.1,2.3,0.1),3,4) x [1] 1.0 2.0 2.1 2.2 2.3 3.0 4.0 spread(x) [1] 1 2

[R] differentiating a numeric vector

2008-03-05 Thread Levi Waldron
What functions exist for differentiating a numeric vector (in my case spectral data)? That is, experimental data without an analytical function. ie, x - seq(1,10,0.1) y=x^3+rnorm(length(x),sd=0.01) #although the real function would be nothing simple like x^3... derivy - I know I

[R] summarizing replicates with multiple treatments

2008-03-04 Thread Levi Waldron
I have a dataframe with several different treatment variables, and would like to calculate the mean and standard deviation of the replicates for each day and treatment variable. It seems like it should be easy, but I've only managed to do it for one treatment at a time using subset and tapply.

Re: [R] summarizing replicates with multiple treatments

2008-03-04 Thread Levi Waldron
On Tue, Mar 4, 2008 at 5:32 PM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: library(doBy) summaryBy(. ~ day + treat, exampledata, FUN = c(mean, sd)) Outstanding, so much better. Thanks. __ R-help@r-project.org mailing list