Re: [R] How to plot shades between curves?

2015-10-18 Thread Benno Pütz
> > plot(Capa.diss,Capa.diss.age,ylim = > rev((range)(Capa.diss.age=c(min(Capa.diss.age), > 10500))),xlim=(c(0,30)),type="l") > Capa.diss2<-Capa.diss*0.7 > par(new=TRUE) > plot(Capa.diss2, Capa.diss.age, col='black',type="l",ylim = > rev((range)(Capa.diss.age=c(min(Capa.diss.age), 10500))), >

Re: [R] How to unzip a .gz file

2015-02-10 Thread Benno Pütz
readLines (as well as other I/O routines) handles gzip files transparently, you should be able to simply use readLines('/home/file.gz’) Benno On 10 Feb 2015, at 22:45 , Alexandra Catena amc5...@gmail.com wrote: Hello, Can someone help me with unzipping a .gz file. I used:

Re: [R] Equivalent to matlab .* operator in R

2014-11-19 Thread Benno Pütz
It can be simplified a bit, though, as the second operand in the multiplication does not need to be a matrix: y * rep(z,each=3) On 19 Nov 2014, at 16:24 , Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: When your matrices are the same size, the * operator does what you want.

Re: [R] how to overwrite a Unary operator ?

2014-10-17 Thread Benno Pütz
On 17 Oct 2014, at 06:29, PO SU rhelpmaill...@163.com wrote: e.g. 2++ will let 2 be 3 That would not even work in C ... While I use this in C, I second Rolf on the general issue. Benno__ R-help@r-project.org mailing list

Re: [R] How to troubleshoot issue with curve() function?

2014-06-25 Thread Benno Pütz
I’d start trying to understand the error message - it is actually pretty clear (see ?curve). I suspect curve is not the function you want to use, rather something like plot(data$arrival_time, dexp(data$arrival_time, rate=0.06), xlim = c(0, 60), type=‘l’, main = Exponential distribution”)

Re: [R] Pattern Matching

2014-03-02 Thread Benno Pütz
Try as.numeric(sub(.*\\(,, sub('\\)','',aa))) You may also want to look at regexec/regmatches for a more general approach ... On 02 Mar 2014, at 20:55, Doran, Harold hdo...@air.org wrote: 1 (472) 2 (445) 3 (431) 3 (431) 5 (415) 6 (405) 7 (1)” Benno Pütz Statistical Genetics MPI of Psychiatry

Re: [R] Execute a function

2012-07-20 Thread Benno Pütz
code. Benno Pütz Statistical Genetics MPI of Psychiatry Kraepelinstr. 2-10 80804 Munich, Germany T: ++49-(0)89-306 22 222 F: ++49-(0)89-306 22 601 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https

Re: [R] Median computation

2012-05-23 Thread Benno Pütz
]] __ 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. Benno Pütz Statistical Genetics MPI of Psychiatry

Re: [R] Positioning text in top left corner of plot

2012-02-07 Thread Benno Pütz
. __ 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. Benno Pütz Statistical Genetics MPI of Psychiatry

Re: [R] Positioning text in top left corner of plot

2012-02-07 Thread Benno Pütz
the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Benno Pütz Statistical Genetics MPI of Psychiatry Kraepelinstr. 2-10 80804 Munich, Germany T: ++49-(0)89-306 22 222 F: ++49-(0)89-306 22 601

Re: [R] how to unzip files in R

2012-02-01 Thread Benno Pütz
and provide commented, minimal, self-contained, reproducible code. Benno Pütz Statistical Genetics MPI of Psychiatry Kraepelinstr. 2-10 80804 Munich, Germany T: ++49-(0)89-306 22 222 F: ++49-(0)89-306 22 601 [[alternative HTML version deleted

Re: [R] Text annotation of a graph

2011-08-05 Thread Benno Pütz
Hi Lisa, On 4.Aug.2011, at 22:24, Lisa wrote: Dear All, I am trying to add some text annotation to a graph using matplot() as follows: vars - c(v1, v2, v3, v4, v5, v6, v7, v8, v8, v10) id - seq(5.000, 0.001, by = -0.001) sid - c(4.997, 3.901, 2.339, 0.176, 0.151, 0.101, 0.076,

Re: [R] Adjusting p values of a matrix

2011-04-04 Thread Benno Pütz
How about as.matrix(p.adjust(as.dist(pmat))) Benno On 4.Apr.2011, at 17:02, January Weiner wrote: Dear all, I have an n x n matrix of p-values. The matrix is symmetrical, as it describes the each against each p values of correlation coefficients. How can I best correct the p

Re: [R] slicing list with matrices

2010-11-17 Thread Benno Pütz
Maybe lapply(l,function(x){x[1,1]}) or unlist(lapply(l,function(x){x[1,1]})) does what you want? Benno Am 17.Nov.2010 um 15:01 schrieb soeren.vo...@eawag.ch: m - matrix(1:9, nrow=3, dimnames=list(LETTERS[1:3], letters[1:3])) l - list(m1=m, m2=m*2, m3=m*3) l[[3]]

Re: [R] Determine area between two density plots

2010-09-23 Thread Benno Pütz
Am 23.Sep.2010 um 18:27 schrieb Ralf B: I wonder what the best way is to access those values. I am using the following code: x1 - c(1,2,1,3,5,6,6,7,7,8) x2 - c(1,2,1,3,5,6,5,3,8,7) d1 - density(x1, na.rm = TRUE) d2 - density(x2, na.rm = TRUE) plot(d1, lwd=3, main=bla) lines(d2, lty=2,

Re: [R] Draw a perpendicular line?

2010-08-25 Thread Benno Pütz
Maybe perp.slope = -1/slope abline(cy - cx*perp.slope, perp.slope) where cx, cy are x- and y-coordinate of C, resp., and slope the slope you calculated for the line through A and B Am 24.Aug.2010 um 0:04 schrieb CZ: Hi, I am trying to draw a perpendicular line from a point to two

Re: [R] Sweave counter

2010-05-18 Thread Benno Pütz
Under UNIX I usually write something like system(paste(echo ',...,', sep=sep)) where I replace the '...' with whatever I need to show. This would need some adjustments for non-scalars, though. Benno Am 18.Mai.2010 um 19:10 schrieb Jimmy Söderly: Dear R users, I am using the

Re: [R] PDF Compression

2009-07-30 Thread Benno Pütz
Thanks for this advice - and to second Gabor's experience: I just tried it on a couple of my files and achieved reductions on the order of 90% (28.6MB to 4.4MB and 1.5GB to 170MB)! This file contains lots of small plots but also many scattersmooth()- images ... So I think it does quite well

Re: [R] how to inspect content of save() file

2009-04-26 Thread Benno Pütz
Am 22.Apr.2009 um 21:45 schrieb Duncan Temple Lang: Hi Benno et al. I have had some code for reading RDA files via R functions and binary connections. It is available from http://www.omegahat.org/RDA or install.packages(RDA, repos = http://www.omegahat.org/R;,

Re: [R] how to inspect content of save file

2009-04-22 Thread Benno Pütz
Am 21.Apr.2009 um 19:16 schrieb Dimitri Liakhovitski: Can't you just read in the very first line of the file (that contains names)? Dimitri 2009/4/21 Benno Pütz pu...@mpipsykl.mpg.de: Is there a way of listing the variables contained in a file created with the save() command other than

Re: [R] how to inspect content of save() file

2009-04-22 Thread Benno Pütz
Am 22.Apr.2009 um 17:21 schrieb Dimitri Liakhovitski: Why do you use save()? Can't you write out data frame(s) with your variables in a .txt or a .csv file and then read in just the variable names? I could, but ... As save() writes a binary (and by default compressed) format that is

[R] how to inspect content of save file

2009-04-21 Thread Benno Pütz
Is there a way of listing the variables contained in a file created with the save() command other than load()ing the file? I have a couple of rather larger files that I would rather not load ... Benno Pütz MPI of Psychiatry Tel: +49+(0)89-30622 222 Kraepelinstr. 2 Fax

Re: [R] 'for' loop, two variables

2008-07-29 Thread Benno Pütz
On 29.Jul.2008, at 14:13, ONKELINX, Thierry wrote: Dear Frederike, #Both your functions are vectorized. So you don't need loops. Working with vectorized functions is much faster than looping. fn - function (x,y) { ifelse(x46 x52 y12, 1, 0) } datagrid - expand.grid(i = 40:60, j = 0:20)