Re: [R] Artifacts in filled.contour+pdf

2010-10-25 Thread baptiste auguie
Hi, As an alternative, maybe you could use lattice::panel.levelplot.raster which I think doesn't have this problem in pdf viewers. HTH, baptiste On 26 October 2010 02:30, David Winsemius dwinsem...@comcast.net wrote: On Oct 25, 2010, at 6:50 AM, Mario Valle wrote: Dear all, I'm using R

Re: [R] ggplot2: how to label lines?

2010-10-26 Thread baptiste auguie
Hi, Have a look at the directlabels package; it does just that for lattice and ggplot2. HTH, baptiste On 26 October 2010 08:02, Jeffrey Spies jsp...@virginia.edu wrote: Hi, all, Let's say I have some time series data--10 subjects measured 20 times--that I plot as follows:

Re: [R] extracting named vector from dataframe

2010-10-31 Thread baptiste auguie
Hi, I think you want ?unlist d = data.frame(x=1, y=2, z=3) v = unlist(d) is(v) [1] numeric vector HTH, baptiste On 31 October 2010 16:54, James Hirschorn james.hirsch...@hotmail.com wrote: Suppose df is a dataframe with one named row of numeric observations. I want to coerce df into a named

Re: [R] Using R for Production - Discussion

2010-11-02 Thread baptiste auguie
Hi, Regarding your '10 commandments' in Q3, you may find useful tips in the R inferno by Pat Burns. HTH, baptiste On 2 November 2010 05:04, Santosh Srinivas santosh.srini...@gmail.com wrote: Hello Group, This is an open-ended question. Quite fascinated by the things I can do and the

Re: [R] How do I order xyplot line points?

2010-11-07 Thread baptiste auguie
Hi, try this, xyplot(Time~Chromosome|factor(Elements), data = mtx[order(mtx$Chromosome), ], ... [snipped]) HTH, baptiste On 7 November 2010 13:17, Alex Reynolds reyno...@u.washington.edu wrote: I have the following xyplot figure:  

Re: [R] [lattice] densityplot label the peak.

2010-11-10 Thread baptiste auguie
Hi, The easiest way might be the directlabels package from R-forge. Otherwise, you could write your own panel function. HTH, baptiste On 10 November 2010 23:01, Joon Yeong Kim joonyeen...@gmail.com wrote: Hi, I've been trying to find a way to label the the peak or mean of a densityplot

Re: [R] rasterImage and coordinate conversion

2010-11-18 Thread baptiste auguie
Hi, For curiosity's sake, below is another version with ggplot2 and Grid graphics, library(pixmap) logo - read.pnm(system.file(pictures/logo.ppm, package=pixmap)[1]) library(ggExtra) # r-forge, requires gridExtra qplot(rnorm(100),rnorm(100)) + annotate(pixmap, x=-Inf, y=-Inf, picture=logo,

Re: [R] how to draw manifold?

2010-11-21 Thread baptiste auguie
Hi, I'm joining in with a question -- is it possible to vary the color of the lines along z? The 'colors' argument doesn't seem to allow a vector in this situation. Thanks, baptiste On 21 November 2010 21:02, Carl Witthoft c...@witthoft.com wrote: Thanks, Dennis.   Here's an enhanced

Re: [R] Is it possible to make a matrix to start at row 0?

2010-11-22 Thread baptiste auguie
Apparently He who starts from 0 needn't be called unfortunate, fortune('indexed') baptiste On 22 November 2010 20:59, Ben Bolker bbol...@gmail.com wrote: Bert Gunter gunter.berton at gene.com writes: Eh??? Why would you want to do that?? (R isn't C). So the simple answer is: you can't.

Re: [R] specifying colours in a ggplot2 piechart

2010-11-23 Thread baptiste auguie
fixing the various typos in your code, this works, lat_plot() + scale_fill_manual(value=mycolours) HTH, baptiste On 23 November 2010 19:47, John Kane jrkrid...@yahoo.ca wrote: Someone was asking how to do a 16 category piechart in OpenOffice Calc and it appears that it can not be done

Re: [R] specifying colours in a ggplot2 piechart

2010-11-23 Thread baptiste auguie
have any idea why  scale_colour_manual(value=mycolours) does not work.  More typos on my part or am I misunderstanding what   scale_colour_manual(value=mycolours) is supposed to do? Thanks --- On Tue, 11/23/10, baptiste auguie baptiste.aug...@googlemail.com wrote: From: baptiste auguie

Re: [R] apply over list of data.frames

2010-11-24 Thread baptiste auguie
Hi, Try this, do.call(`+`, x) / length(x) HTH, baptiste On 24 November 2010 20:37, Tim Howard tghow...@gw.dec.state.ny.us wrote: R users, This probably involves a simple incantation of one of the flavors of apply... that I can't yet figure out. Consider a list of data frames. I'd like to

Re: [R] Comparing two functions

2010-11-28 Thread baptiste auguie
Hi, Your function fails for a number of reasons. One of them is your comparison (use browser() to see what is the value taken by f in your function). Also, n, mean, min and max could not be extracted from ... with your construction. Here's my suggestion, randomIra = function(f=runif, ...){

Re: [R] Bug 14340 - Symbols() plots with wrongly scaled y-axis

2010-07-17 Thread baptiste auguie
Hi, try adding asp=1 in symbols() to set the aspect ratio of the plotting region to 1. HTH, baptiste On 17 July 2010 18:21, nancy...@gmail.com wrote: Hello, I submitted this bug report to r-core and got a rejection saying I should post to r-help. This is my first time ever submitting a

Re: [R] R graphic help

2010-07-18 Thread baptiste auguie
Hi, There may be a simpler way but try this, plot(10^jitter(seq(-2,4,length=10)), 1:10, log=x, xaxt=n) axis(1, at = axTicks(1),labels = format(axTicks(1),scientific=FALSE)) HTH, baptiste On 18 July 2010 10:58, Timothy O'Brien teobr...@gmail.com wrote: Dear All, I've done some searching,

Re: [R] Sum list elements

2010-07-27 Thread baptiste auguie
Hi, do.call(sum, mylist) ?do.call baptiste On 27 July 2010 14:36, Nicola Sturaro Sommacal mailingl...@nicolasturaro.com wrote: Hi! I have a list of 24 elements, all of the same type (dataframe, for example). I am looking for an alternative to mylist[[1]] + mylist[[2]] + ... +

Re: [R] hatching posibility in Panel.Polygon

2010-07-28 Thread baptiste auguie
Hi, library(gridExtra) example(patternGrob) provides some patterns to fill a rectangular area using Grid graphics. It could in theory be used in lattice. I wouldn't use it either, but I can imagine how it might be useful on very special occasions. Best, baptiste On 28 July 2010 06:11, HC

Re: [R] Output (graphics and table/text)

2010-08-05 Thread baptiste auguie
Hi, To add tables, the gplots package has a textplot() function, and for Grid graphics there is a grid.table() function in gridExtra. HTH, baptiste On 5 August 2010 00:02, Ralf B ralf.bie...@gmail.com wrote: Hi R Users, I need to produce a simple report consisting of some graphs and a

Re: [R] help to polish plot in ggplot2

2010-08-11 Thread baptiste auguie
Hi, One way you could do it is to create a separate graph for each category. The y axis labels would replace the strip labels. You could then stack the graphs on the page, and add a common legend. The tricky part would be to make sure the different panels have the same width and height. Another

Re: [R] help to polish plot in ggplot2

2010-08-12 Thread baptiste auguie
=theme_blank()) + opts( axis.title.y = foo()) HTH, baptiste On 12 August 2010 07:44, baptiste auguie baptiste.aug...@googlemail.com wrote: Hi, One way you could do it is to create a separate graph for each category. The y axis labels would replace the strip labels. You could then stack

Re: [R] find value between two other numbers?

2010-08-13 Thread baptiste auguie
Hi, I see no need to construct the vector, try this instead, belong = function(x=4, y=c(1,10)) x = y[2] x = y[1] see also ?findInterval HTH, baptiste On 13 August 2010 01:10, fishkbob fishk...@gmail.com wrote: So basically I want to do this - 4 %in% 1:10 should return true Would

[R] cacheSweave / pgfSweave driver for package vignette

2010-08-13 Thread baptiste auguie
Dear list, I wish to use a specific driver to process an sweave document in the inst/doc directory of a package. Specifically, I would like to use either cacheSweave or pgfSweave to speed up the creation of the vignette which requires lengthy computations. The same request would also apply to

Re: [R] cacheSweave / pgfSweave driver for package vignette

2010-08-14 Thread baptiste auguie
and, say, pgfSweave in the same document. Sincerely, baptiste On 13 August 2010 11:10, Romain Francois romain.franc...@dbmail.com wrote: Hi, I've been meaning to ask the same question before. Le 13/08/10 11:01, baptiste auguie a écrit : Dear list, I wish to use a specific driver

Re: [R] grid.table and expression in table body?

2010-08-17 Thread baptiste auguie
] gridExtra_0.7 loaded via a namespace (and not attached): [1] tools_2.11.1 On Monday 09 August 2010 12:02:03 baptiste auguie wrote: I just uploaded version 0.7 on googlecode. I had inadvertently messed up the previous attempt (uploaded an older version from another computer). Fingers crossed

Re: [R] plotmath question

2010-08-19 Thread baptiste auguie
Try this, b = 20 plot(1, ylab= bquote(italic(P) * .(b)) ) HTH, baptiste On 19 August 2010 20:02, array chip arrayprof...@yahoo.com wrote: Hi all, let me give a simple example: b-20 I would like to print ylab as P20 where P is printed in Italic font. When I do the following: plot(1,

[R] R-level expansion of Rplot%03d.png

2010-08-21 Thread baptiste auguie
Dear list, I'm using the brew package to generate a report containing various plots. I wrote a function that creates a plot in png and pdf formats, and outputs a suitable text string to insert the file in the final document using the asciidoc syntax, % tmp - 1 makePlot = function(p,

Re: [R] R-level expansion of Rplot%03d.png

2010-08-21 Thread baptiste auguie
kees.duinev...@gmail.com wrote: Not sure what you want. Plot does that automatically. It seems to use path.expand() to make the %03d expansion. Not that path.expand() is documented to do this, but it seem to work. Kees On Sat, 21 Aug 2010 13:04:54 +0200, baptiste auguie baptiste.aug

Re: [R] R-level expansion of Rplot%03d.png

2010-08-21 Thread baptiste auguie
(noquote(paste('image:',real.name.png,',width=',width,',link=real.name.pdf) } On Sat, 21 Aug 2010 14:02:04 +0200, baptiste auguie baptiste.aug...@googlemail.com wrote: My function needs to do two things with the filename: First, create the plot file. For this, Rplot%03d is OK because

Re: [R] R-level expansion of Rplot%03d.png

2010-08-21 Thread baptiste auguie
) print(p) dev.off() pdf(real.name.pdf) print(p) dev.off() cat(noquote(paste('image:',real.name.png,',width=',width,',link=real.name.pdf) } On Sat, 21 Aug 2010 14:02:04 +0200, baptiste auguie baptiste.aug...@googlemail.com wrote: My function needs to do two things with the filename: First

Re: [R] graphing plots of plots

2010-08-21 Thread baptiste auguie
Hi, I think you could do it quite easily with lattice, library(lattice) latticeGrob - function(p, ...){ grob(p=p, ..., cl=lattice) } drawDetails.lattice - function(x, recording=FALSE){ lattice:::plot.trellis(x$p, newpage=FALSE) } plots - replicate(4,

Re: [R] Draw a perpendicular line?

2010-08-25 Thread baptiste auguie
hi, also, make sure you have set the aspect ratio to 1:1 when plotting (asp=1). HTH, baptiste On 25 August 2010 10:20, Benno Pütz pu...@mpipsykl.mpg.de wrote: 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

[R] export 4D data as povray density files

2010-08-27 Thread baptiste auguie
Dear list, I wish to visualise some 4D data as a kind of colour / translucent cloud in 3D. I haven't seen such plots in R (but perhaps I missed a feature of rgl). The easiest option I found would be to export the data in povray's df3 (density file) format and visualise it with povray. The format

Re: [R] How to plot an expression-label with variable text

2010-08-27 Thread baptiste auguie
hi, try this lab =bquote(paste(Estimated , t[50], from ,.(what))) HTH, baptiste On 27 August 2010 20:19, Dieter Menne dieter.me...@menne-biomed.de wrote: plot.new() lab =expression(paste(Estimated , t[50], from tgv)) text(0.5,0.5,lab) # Should look the same as above. I could not get the

Re: [R] How to Adaptively Set Up the Coordinate Range of Multiple Graphs in One Figure

2010-08-31 Thread baptiste auguie
Hi, It's easy with ggplot2, library(ggplot2) ## create an empty plot p - ggplot(map=aes(x,y)) ## create a dummy list of data.frames with different ranges d - replicate(4, data.frame(x=sample(1:10,1)+rnorm(10), y=sample(1:10,1)+rnorm(10)),

Re: [R] Please explain do.call in this context, or critique to stack this list faster

2010-09-05 Thread baptiste auguie
Another way that I like is reshape::melt.list() because it keeps track of the name of the original data.frames, l = replicate(1e4, data.frame(x=rnorm(100),y=rnorm(100)), simplify=FALSE) system.time(a - rbind.fill(l)) # user system elapsed # 2.482 0.111 2.597 system.time(b - melt(l,id=1:2))

Re: [R] Something similar to layout in lattice or ggplot

2010-09-07 Thread baptiste auguie
On 7 September 2010 17:19, Erik Iverson er...@ccbr.umn.edu wrote: See ?grid.layout or perhaps ?arrange from the gridExtra package. gridExtra::grid.arrange(), rather. baptiste Abhijit Dasgupta wrote: Hi, Is there a function similar to the layout function in base graphics in either lattice

Re: [R] Something similar to layout in lattice or ggplot

2010-09-07 Thread baptiste auguie
arrange() was renamed grid.arrange() when plyr started using this name for a different function. I think it happened in version 0.6.5 of gridExtra. The current version on CRAN is 0.7. baptiste On 7 September 2010 17:46, Erik Iverson er...@ccbr.umn.edu wrote: baptiste auguie wrote: On 7

Re: [R] Matrixes inside matrixes

2010-09-08 Thread baptiste auguie
Hi, You can have each cell of a matrix contain a matrix, but for a reason that is just not clear to me the matrices are wrapped in a list, m = matrix(replicate(4,matrix(1:9,3,3),simplify=FALSE), 2,2) m[1,2][[1]] str(m) and even more surprising to me, m itself has become a list for some

Re: [R] large files produced from image plots?

2010-09-08 Thread baptiste auguie
Hi, I get the same crash with x11() with sessionInfo() R version 2.11.1 (2010-05-31) x86_64-apple-darwin9.8.0 locale: [1] en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages: [1] grid stats graphics grDevices utils datasets methods [8] base However it

[R] scalable delimiters in plotmath

2010-09-09 Thread baptiste auguie
Dear list, I read in ?plotmath that I can use bgroup to draw scalable delimiters such as [ ] and ( ). The same technique fails with however, and I cannot find a workaround, grid.text(expression(bgroup(,atop(x,y),))) Error in bgroup(, atop(x, y), ) : invalid group delimiter Regards, baptiste

Re: [R] scalable delimiters in plotmath

2010-09-11 Thread baptiste auguie
What do people use to show angle brackets in R graphics? Have I missed something obvious? Thanks, baptiste On 9 September 2010 17:57, baptiste auguie baptiste.aug...@googlemail.com wrote: Dear list, I read in ?plotmath that I can use bgroup to draw scalable delimiters

Re: [R] scalable delimiters in plotmath

2010-09-12 Thread baptiste auguie
) )~symbol(\361)), cex.main=3) scriptstyle shrinks the inner atop() material, and since I tested on a Mac it should work for Baptiste. -- David.  -Peter Ehlers On Sat, Sep 11, 2010 at 10:01 AM, baptiste auguie baptiste.aug...@googlemail.com  wrote: What do people use to show angle

Re: [R] scalable delimiters in plotmath

2010-09-12 Thread baptiste auguie
, at 6:15 AM, baptiste auguie wrote: Thanks everyone. I've also had a look at plotmath.c where bgroup is defined for [, {, (, . but not . It seems quite trivial to add it, at first sight, however there is a part that I don't understand in the RenderDelim routine, static BBOX RenderDelim(int

Re: [R] scalable delimiters in plotmath

2010-09-12 Thread baptiste auguie
., baptiste auguie wrote: Oh, right I see. I was completely off then. Maybe it's not so easy to add  delimiters after all, I'll have to look at the list of symbol pieces to see if these can be constructed too. The plotmath stuff assumes a font with an Adobe Symbol encoding.  The characters we have

[R] bivariate vector numerical integration with infinite range

2010-09-21 Thread baptiste auguie
Dear list, I'm seeking some advice regarding a particular numerical integration I wish to perform. The integrand f takes two real arguments x and y and returns a vector of constant length N. The range of integration is [0, infty) for x and [a,b] (finite) for y. Since the integrand has values in

[R] puzzle with integrate over infinite range

2010-09-21 Thread baptiste auguie
Dear list, I'm calculating the integral of a Gaussian function from 0 to infinity. I understand from ?integrate that it's usually better to specify Inf explicitly as a limit rather than an arbitrary large number, as in this case integrate() performs a trick to do the integration better. However,

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread baptiste auguie
Warning message: In sqrt(x) : NaNs produced -- David On Sep 21, 2010, at 4:11 AM, baptiste auguie wrote: Dear list, I'm seeking some advice regarding a particular numerical integration I wish to perform. The integrand f takes two real arguments x and y and returns a vector of constant

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread baptiste auguie
. Thanks, baptiste On 21 September 2010 14:26, Hans W Borchers hwborch...@googlemail.com wrote: baptiste auguie baptiste.auguie at googlemail.com writes: Dear list, I'm seeking some advice regarding a particular numerical integration I wish to perform. The integrand f takes two real

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread baptiste auguie
I see, thank you. I'm still worried by the very dramatic error I obtained just from shifting so slightly the support of the integrand, it took me a while to figure what happened even with this basic example (I knew the integral couldn't be so small!). For a general integration in [0, infty),

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread baptiste auguie
) is not numeric or has wrong dimension Best, baptiste On 21 September 2010 17:11, Hans W Borchers hwborch...@googlemail.com wrote: baptiste auguie baptiste.auguie at googlemail.com writes: Thanks, adaptIntegrate() seems perfectly suited, I'll just need to figure a transformation rule for the infinite

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread baptiste auguie
Got it, thanks! baptiste On 21 September 2010 22:38, Hans W Borchers hwborch...@googlemail.com wrote: baptiste auguie baptiste.auguie at googlemail.com writes: Thanks. I am having trouble getting adaptIntegrate to work with a multivalued integrand though, and cannot find a working example

[R] lattice centre a diverging colour scale

2010-09-23 Thread baptiste auguie
Dear list, I'm using lattice::levelplot to plot a coloured image of 3D data. The range of the z values goes from negative to positive, but is not exactly centred around 0. I would however like to map a diverging colour scale with white falling exactly at 0, and both extremes being symmetrical in

Re: [R] boundary check

2010-09-24 Thread baptiste auguie
Hi, I remember a discussion we had on this list a few months ago for a better way to decide if a point is inside a convex hull. It eventually lead to a R function in this post, http://tolstoy.newcastle.edu.au/R/e8/help/09/12/8784.html I don't know if it was included in the geometry package in

Re: [R] Facets in ggplot2

2010-10-01 Thread baptiste auguie
Try this, qplot(outcome, counts, data=d.AD, facets=.~ treatment) HTH, baptiste __ 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

Re: [R] Include externally generated pdf in output (without Sweave)

2010-10-03 Thread baptiste auguie
Hi, Check the grImport package (I think it has a vignette, perhaps on Paul Murrell's homepage.) HTH, baptiste On 3 October 2010 14:52, Tal Galili tal.gal...@gmail.com wrote: Hello Dieter, Looking at this thread (from 2005) http://tolstoy.newcastle.edu.au/R/help/05/10/14320.html It seems

Re: [R] Plot table as table

2010-10-13 Thread baptiste auguie
Hi, grid.table in gridExtra might give you some inspiration. HTH, baptiste On 13 October 2010 10:14, Joel joda2...@student.uu.se wrote: It should look something like this (not at all relevant except the look) http://r.789695.n4.nabble.com/file/n2993297/tableR19.jpg -- View this message

Re: [R] overwritten plots in pdf file

2009-09-29 Thread baptiste auguie
Hi, Try opening and closing the device outside the loop, pdf(D:/research/plot.pdf) for (i in 1:n) { plot(mon, mu, type ='o') } dev.off() HTH, baptiste __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Macro variable substitution

2009-09-29 Thread baptiste auguie
Hi, I guess you want ?assign See also this page for a working example, http://wiki.r-project.org/rwiki/doku.php?id=guides:assigning-variable-names HTH, baptiste 2009/9/29 David Young dyo...@telefonica.net: Hello All, I'm a new R user and have a question about what in SAS would be called

Re: [R] lattice: How to display no box but only a y-axis on the left + Thicker lines

2009-09-30 Thread baptiste auguie
2009/9/30 lith minil...@gmail.com: Yes. You can get back the tick marks with scaless$col: Thanks for the hint. May I kindly ask what would be the easiest way to draw a line on the left side? Try this, mpanel = function(...) { grid.segments(0,0,0,1) ; panel.bwplot(...) } bwplot(y~x,

Re: [R] dichromat, regexp, and grid objects

2009-09-30 Thread baptiste auguie
the code for colour and fill regular expressions... baptiste 2009/9/28 baptiste auguie baptiste.aug...@googlemail.com: Dear list, The dichromat package defines a dichromat function which Collapses red-green color distinctions to approximate the effect of the two common forms of red-green colour

Re: [R] A point in a vector?

2009-09-30 Thread baptiste auguie
Hi, assuming v is sorted, try this, v[ findInterval(x,v)+0:1 ] see ?findInterval and perhaps ?cut HTH, baptiste 2009/9/30 Corrado ct...@york.ac.uk: Dear list, I have a strange requirement I have a vector, for example v- c(0,0,0,0,1,2,4,6,8,8,8,8). I have a value,for example x-

[R] pass ... to multiple sub-functions

2009-10-01 Thread baptiste auguie
Dear list, I know I have seen this discussed before but I haven't been successful in searching for ellipsis, dots, ... in the archives. I would like to filter ... arguments according to their name, and dispatch them to two sub-functions, say fun1 and fun2. I looked at lm() but it seemed more

Re: [R] pass ... to multiple sub-functions

2009-10-01 Thread baptiste auguie
2009/10/1 Peter Ruckdeschel peter.ruckdesc...@web.de: removed - c(lty,params.fun1) ## I assume you do not want to pass on argument lty... dots.remaining - cl[-1] ### remove the function name dots.remaining - dots.remaining[! names(dots.remaining) %in%

Re: [R] Looking for a better way to document my packages

2009-10-01 Thread baptiste auguie
Hi, I know of three options that resemble your query, - the roxygen package - a ruby script called weeder by Hadley Wikham - the inlinedocs package on r-forge I only ever used roxygen though, so i can't speak for the relative merits of the others. HTH, baptiste 2009/10/1 Steve Lianoglou

[R] inverse currying

2009-10-01 Thread baptiste auguie
Dear list, I have the following function, sugar = function(fun, id = id){ ff - formals(fun) if( id %in% names(ff)) stop(id is part of args(fun)) formals(fun) - c(unlist(ff), alist(id=)) fun } which one may use on a function foo, foo = function(x){ x } sugar(foo) # results in the

Re: [R] plot ᵒ C in graph axis label

2009-10-02 Thread baptiste auguie
Hi, You cannot start with a * in expression(). Try this, plot(x~y,ylab=expression(~degree~C)) or even, as a short-cut, plot(x~y,ylab=~degree~C) HTH, baptiste 2009/10/2 e-letter inp...@gmail.com: Readers, I have tried to use a plotmath command to add the temperature degree sign (i.e. ᵒ

Re: [R] plot scale

2009-10-02 Thread baptiste auguie
Hi, It looks like lattice or ggplot2 might make this easier, but I'm not entirely sure I understood the problem, short of an example. Best, baptiste 2009/10/2 Duncan Murdoch murd...@stats.uwo.ca: On 02/10/2009 4:07 AM, Ben Kenward wrote: Hi, Is there a way to set the scale of a plot (i.e.

Re: [R] plot subscript text and percentage symbol in graph label axis

2009-10-02 Thread baptiste auguie
try this, plot(x~y,ylab=expression(~degree~C),xlab=expression(x[2]~%)) baptiste 2009/10/2 e-letter inp...@gmail.com: Readers, I am unable to plot a label consisting of both subscript text and percentage (%) symbol: x-(1:10) y-(200:191)

Re: [R] inverse currying

2009-10-02 Thread baptiste auguie
) fun } foo = function(x, a=1){ x } sugar(foo) sugar(foo, 'a') sugar(sugar(foo)) sugar(foo, 'my.new.arg') Best, baptiste 2009/10/1 baptiste auguie baptiste.aug...@googlemail.com: Dear list, I have the following function, sugar = function(fun, id = id){  ff - formals(fun)  if( id

Re: [R] add lines() to 1st plot in layout() after calling 2nd plot()?

2009-10-04 Thread baptiste auguie
Hi, Try this, dev.new() layout(matrix(1:4,2, by=T)) plot(1:10,main=top left plot) plot(1:10,main=top right plot) plot(1:10,main=bottom left plot) plot(1:10,main=bottom right plot) for (ii in 1:2){ for (jj in 1:2){ par(mfg=c(ii,jj)) text(5,2, lab=paste(plot #:,ii,,,jj,sep=)) } } par(mfg=c(1,1))

Re: [R] add lines() to 1st plot in layout() after calling 2nd plot()?

2009-10-04 Thread baptiste auguie
for simple ones. Best regards, baptiste 2009/10/4 baptiste auguie baptiste.aug...@googlemail.com: Hi, Try this, dev.new() layout(matrix(1:4,2, by=T)) plot(1:10,main=top left plot) plot(1:10,main=top right plot) plot(1:10,main=bottom left plot) plot(1:10,main=bottom right plot

Re: [R] ggplot2: proper use of facet_grid inside a function

2009-10-05 Thread baptiste auguie
Hi, Whether or not what follows is to be recommended I don't know, but it seems to work, p - ggplot(diamonds, aes(carat, ..density..)) + geom_histogram(binwidth = 0.2) x = quote(cut) facets = facet_grid(as.formula(bquote(.~.(x p + facets HTH, baptiste 2009/10/5 Bryan Hanson

Re: [R] ggplot2: proper use of facet_grid inside a function

2009-10-05 Thread baptiste auguie
Now why do I always come up with a twisted bquote() where a simple paste() would do! Thanks, baptiste 2009/10/5 hadley wickham h.wick...@gmail.com: Whether or not what follows is to be recommended I don't know, but it seems to work, p - ggplot(diamonds, aes(carat, ..density..)) +  

Re: [R] italics help in plot

2009-10-06 Thread baptiste auguie
Hi, Try this, x= my title plot(1,1, main = bquote(italic(.(x HTH, baptiste 2009/10/6 Jacob Kasper jacobkas...@gmail.com: Part of my script reads: speciesName - names(data)[i] plot(year,depth, xlab=Year, ylab=Depth(m),main=expression(italic(paste(speciesName))) ) Unfortunately,

Re: [R] ggplot2: mapping categorical variable to color aesthetic with faceting

2009-10-06 Thread baptiste auguie
Hi, I may be missing an important design decision, but could you not have only a single data.frame as an argument of your function? From your example, it seems that the colour can be mapped to the fac1 variable of data, compareCats - function(data) { require(ggplot2) p - ggplot(data,

Re: [R] ggplot2: mapping categorical variable to color aesthetic with faceting

2009-10-06 Thread baptiste auguie
and there last_plot() %+% test[-rem, ] # replot with new dataset HTH, baptiste 2009/10/6 baptiste auguie baptiste.aug...@googlemail.com: Hi, I may be missing an important design decision, but could you not have only a single data.frame as an argument of your function? From your example, it seems

Re: [R] ggplot equivalent of par(xaxt)

2009-10-06 Thread baptiste auguie
Hi, 2009/10/6 John Kane jrkrid...@yahoo.ca: How do I suppress the numbers on the x-axis? Try this, p + opts(axis.text.x = theme_blank()) HTH, baptiste Thanks      __ [[elided Yahoo spam]]

Re: [R] ggplot equivalent of par(xaxt)

2009-10-06 Thread baptiste auguie
very much. --- On Tue, 10/6/09, baptiste auguie baptiste.aug...@googlemail.com wrote: From: baptiste auguie baptiste.aug...@googlemail.com Subject: Re: [R] ggplot equivalent of par(xaxt) To: John Kane jrkrid...@yahoo.ca Cc: R R-help r-h...@stat.math.ethz.ch Received: Tuesday, October 6

Re: [R] two plots on the same axis

2009-10-07 Thread baptiste auguie
Hi, Your two data sets have a different year so I'm not sure what you want to do with the x axis. The code below plots both data sets on the same graph, with a range of two years, d1 - read.table(~/Downloads/2005.txt) d2 - read.table(~/Downloads/2006.txt) cleanup - function(d){ names(d) -

Re: [R] Slope between two points

2009-10-08 Thread baptiste auguie
Hi, Like this perhaps? slope = diff(y) / diff(x) str(slope) num [1:499] 1.5068 -1.8406 2.1745 0.0676 -2.6088 ... HTH, baptiste 2009/10/8 FMH kagba2...@yahoo.com: Dear All, Let  499 piece-wise lines were buit up by 500 pair of observations, via R code below. x - 1:500 y - rnorm(500)

Re: [R] xyplot#strips like ggplot?

2009-10-08 Thread baptiste auguie
Hi, Try the useOuterStrips function in the latticeExtra package. HTH, baptiste 2009/10/8 Christian Ritter crit...@ridaco.be: Dear all, I want to split the strips in xyplot and push them into the margins ... Tried to find this in common documentation (such as Deepayan's book) on lattice

[R] proto and get()

2009-10-08 Thread baptiste auguie
Dear all, In mucking around with ggplot2, I've hit the following snag, library(ggplot2) # this returns a grob, OK GeomAbline$icon() # lines[GRID.lines.9] # this returns the function icon, OK GeomAbline$icon # proto method (instantiated with ): function (.) # linesGrob(c(0, 1), c(0.2, 0.8)) #

Re: [R] proto and get()

2009-10-08 Thread baptiste auguie
... without answering my previous question, I have just found a fortune-hate workaround, getIcon - function(geom){ st - paste(Geom, firstUpper(geom),$icon, sep=) eval(parse(text=st)) } getIcon(abline) I'm still curious about the get() behaviour though. Best, baptiste

Re: [R] external variable by inside-function routines modifications

2009-10-08 Thread baptiste auguie
Hi, with assign, foo - function(var){ assign(var, var+1, envir = .GlobalEnv) } var =1 foo(2) var # [1] 3 HTH, baptiste 2009/10/8 devol sund...@gmail.com: Dear all,  could you please advice whether it is possible somehow to modify an external (from the point of some function view)

Re: [R] field names as function parameters

2009-10-11 Thread baptiste auguie
Hi, I think this is a case where you should use the ?[[ extraction operator rather than $, d = data.frame(a=1:3) mytarget = a d[[mytarget]] HTH, baptiste 2009/10/11 tdm ph...@philbrierley.com: Hi, I am passing a data frame and field name to a function. I've figured out how I can create

Re: [R] Manipulating Arrays

2009-10-11 Thread baptiste auguie
Hi, the abind package can help you with the first query, ## add values library(abind) arr - abind(arr,arr[1,,,] * 2 + 1,along=1) dim(arr) as for the second, maybe you can use negative indexing, ## remove values arr - arr[-2,,,] HTH, baptiste 2009/10/11 ampc ampc2...@gmail.com:

Re: [R] add lines() to 1st plot in layout() after calling 2nd plot()?

2009-10-12 Thread baptiste auguie
- project.org] On Behalf Of baptiste auguie Sent: Sunday, October 04, 2009 3:33 AM To: r-help Subject: Re: [R] add lines() to 1st plot in layout() after calling 2nd plot()? Hi, Try this, dev.new() layout(matrix(1:4,2, by=T)) plot(1:10,main=top left plot) plot(1:10,main=top right plot

Re: [R] Scatter plot using icons (from a gif) instaed of points - is it possible ?

2009-10-14 Thread baptiste auguie
Hi, You'll probably find that there are two parts to your query: 1- import a bitmap into R, for this I'd suggest the wiki page, http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:display-images 2- place the image (now some sort of matrix of colour points) at different locations on a

Re: [R] Code improvement

2009-10-22 Thread baptiste auguie
Hi, I don't know if it helps, but looking at the output of xyplot you can extract the legend (a grid.frame) as follows, library(grid) library(lattice) p = xyplot(x~y, group=x,data=data.frame(x=1:10,y=1:10), auto.key=list(space=right)) legend = with(p$legend$right,

[R] regular expressions

2009-10-26 Thread baptiste auguie
Dear list, I have the following text to parse (originating from readLines as some lines have unequal size), st = c(START text1 1 text2 2.3, whatever intermediate text, START text1 23.4 text2 3.1415) from which I'd like to extract the lines starting with START, and group the subsequent fields in

Re: [R] regular expressions

2009-10-26 Thread baptiste auguie
then grep out the START fields first. On Mon, Oct 26, 2009 at 9:30 AM, baptiste auguie baptiste.aug...@googlemail.com wrote: Dear list, I have the following text to parse (originating from readLines as some lines have unequal size), st = c(START text1 1 text2 2.3, whatever intermediate

Re: [R] reset par() within plot layout

2009-10-27 Thread baptiste auguie
Hi, From ?par, Value When parameters are set, their former values are returned in an invisible named list. Therefore opar - par(col=red) will not contain col=red. HTH, baptiste 2009/10/27 Janke ten Holt j.c.ten.h...@rug.nl: This seems to work indeed. But I don't understand why... I would

Re: [R] Why I get this error? Error in close.connection(f) : invalid connection

2009-10-27 Thread baptiste auguie
Hi, From ?read.csv Alternatively, file can be a readable text-mode connection (which will be opened for reading if necessary, and if so closed (and hence destroyed) at the end of the function call) HTH, baptiste 2009/10/27 Peng Yu pengyu...@gmail.com: I don't understand why I can not close

Re: [R] read.table but more tables at once

2009-10-28 Thread baptiste auguie
Hi, Try this, files - paste(RA94010,1:3,sep=) # or files - list.files(pattern = RA94010) list.of.data - lapply(files, read.table, header=F) # if required, collapse into a single data.frame do.call(rbind, list.of.data) HTH, baptiste 2009/10/28 Sybille Wendel wendel.sybi...@googlemail.com:

Re: [R] ggplot2: Histogram with negative values on x-axis doesn't work

2009-10-30 Thread baptiste auguie
2009/10/30 hadley wickham h.wick...@gmail.com: I read anything that mentions ggplot2 no matter where it is. ... one should hope this statement only applies to the Internet though, does it? Please do share your regexp if it's not the case. :) baptiste

Re: [R] superscript troubles

2009-11-02 Thread baptiste auguie
Hi, Try this, x = rnorm(1) y = rnorm(1) leg = bquote(r^2*=*.(round(x,digits=3))*, P=*.(round(y, digits=3))) plot.new() legend (bty =n,topright,legend=leg) HTH, baptiste 2009/11/2 Jacob Kasper jacobkas...@gmail.com: I know that this has been revisited over and over, yet I cannot figure out

Re: [R] how to display a string containing greek chrs and variables

2009-11-03 Thread baptiste auguie
Hi, try this, plot.new() x=0.8 text(0.5, 0.5, bquote(rho == .(x))) HTH, baptiste 2009/11/3 j.delashe...@ed.ac.uk: I'm trying something that I thought would be pretty simple, but it's proving quite frustrating... I want to display, for instance, the correlation coefficient rho in a

Re: [R] R and Python

2009-11-04 Thread baptiste auguie
Hi, It looks like SAGE might be another option, http://www.sagemath.org/index.html though I never tried it. HTH, baptiste __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Obtaining midpoints of class intervals produced by cut and table

2009-11-08 Thread baptiste auguie
Hi, Maybe something like this (inspired by ?cut), cut2num - function(f){ labs - levels(f) d - data.frame(lower = as.numeric( sub(\\((.+),.*, \\1, labs) ), upper = as.numeric( sub([^,]*,([^]]*)\\], \\1, labs) )) d$midpoints - rowMeans(d) d } a - c(1, 2, 3, 4, 5, 2, 3,

Re: [R] Find the first values in vector

2009-11-09 Thread baptiste auguie
Hi, One way would be, vec[ cumsum(!vec)==0 ] HTH, baptiste 2009/11/9 Grzes gregori...@gmail.com: Hi ! I have a vector: vec= TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE TRUE  TRUE  FALSE and I'm looking for a method which let me get only the first values equal TRUE from this vector.

  1   2   3   4   5   6   7   8   >