Re: [R] Plot multiple columns

2010-06-01 Thread baptiste auguie
Hi, You could use melt from the reshape package to create a long format data.frame. This is more easy to plot with lattice or ggplot2, and you can then use facetting to arrange several plots on the same page. The dummy example below produces 10 pages of output with 10 graphs per page.

Re: [R] textbox in lattice

2010-06-01 Thread baptiste auguie
Hi, It's not clear what you mean by summary text without a minimal reproducible example. If your text is ordered as a matrix or a data.frame, you might want to try this grid function, gridExtra::grid.table(as.matrix(summary(iris)), theme=theme.white()) If your text has the form of a paragraph,

Re: [R] Faster union of polygons?

2010-06-01 Thread baptiste auguie
Hi, I think you could use a concave hull from the alphahull package, http://yihui.name/en/2010/04/alphahull-an-r-package-for-alpha-convex-hull/ It may be difficult to find the right parameters if the polygons differ widely in edge lengths, though. HTH, baptiste On 2 June 2010 03:53, Remko

Re: [R] Fancy Page layout

2010-05-31 Thread baptiste auguie
Hi, ggplot2 or lattice could help you in creating the plots. Adding a summary will however require some play with Grid graphics; either using gridBase to mix lattice / ggplot2 output with base R graphics (e.g. textplot() from some package I forget), or you'll need to produce the textual summary

Re: [R] substitute, expression and factors

2010-05-19 Thread baptiste auguie
Thank you for the explanation, and the fortune-ish quote, “As the documentation for substitute() says, there is no guarantee that the result makes sense.” Best, baptiste On 19 May 2010 02:59, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 18/05/2010 4:36 PM, baptiste auguie wrote: Dear

Re: [R] x y plot with z coordinate scaling to a color value

2010-05-19 Thread baptiste auguie
Hi, See also ?lattice::xyplot and ?ggplot2::geom_point , either one can do it automatically. HTH, baptiste On 19 May 2010 12:24, Jannis bt_jan...@yahoo.de wrote: Dears, before I start programming my own function I would like to ask you whether there is any function already available that

[R] lattice::panel.levelplot.raster too picky with unequal spacing

2010-05-18 Thread baptiste auguie
Dear all, I got a couple of warnings using panel.levelplot.raster, In panel.levelplot.raster(..., interpolate = TRUE) : 'y' values are not equispaced; output will be wrong although I was quite sure my data were equally spaced (indeed, I created them with seq()). A closer look at the source

Re: [R] lattice::panel.levelplot.raster too picky with unequal spacing

2010-05-18 Thread baptiste auguie
On 18 May 2010 15:30, Deepayan Sarkar deepayan.sar...@r-project.org wrote: Maybe a better test would be isTRUE(all.equal(diff(range(diff(ux))), 0)) I'll try that out for the next release. Sounds good (and works for me), thanks. baptiste __

[R] substitute, expression and factors

2010-05-18 Thread baptiste auguie
Dear list, I am puzzled by this, substitute(expression(x), list(x = factor(letters[1:2]))) # expression(1:2) Why do I get back the factor levels inside the expression and not the labels? The following work as I expected, substitute(expression(x), list(x = letters[1:2])) # expression(c(a, b))

Re: [R] retrieving last R output

2010-05-17 Thread baptiste auguie
Hi, Try this, saveMyWork - .Last.value HTH, baptiste On 17 May 2010 15:07, math_daddy math_da...@hotmail.com wrote: Hello. I ran a simulation that took a few days to complete, and want to analyze the results, but have just realized that I (idiotically) did not assign the output to a

Re: [R] Display Large Matrix as an Image

2010-05-17 Thread baptiste auguie
Hi, try this, m = matrix(runif(2000*2400), nrow=2000) library(grid) grid.raster(m) HTH, baptiste On 17 May 2010 20:35, tetonedge de...@tetonedge.net wrote: I have a matrix that is 2400x2000 and I would like to display it as an image, I have tried image(), but due to the size of the matrix

Re: [R] how to save multiple plots in one PDF file?

2010-05-17 Thread baptiste auguie
No, that's only true for lattice and ggplot2 graphics. The problem here is with this line, windows(width=5, height=5) which shouldn't be there. HTH, baptiste On 17 May 2010 22:23, Jun Shen jun.shen...@gmail.com wrote: If you do plotting in a loop, then you need to print it to the device.

Re: [R] problem with making multiple plots (geom_pointrange) in a loop (ggplot2)

2010-05-16 Thread baptiste auguie
Hi, On 16 May 2010 03:31, michael westphal mi_westp...@yahoo.com wrote: [ snipped ] Any suggestions? i'd suggest you - read the posting guide - upgrade your R to the latest version - don't post to two mailing lists - make your example minimal, self-contained, reproducible - show the result of

Re: [R] graphics::plot Organizing line types, line colors and generating matching legends...

2010-05-10 Thread baptiste auguie
Hi, Lattice and ggplot2 are both ideally suited for this task. Consider this example, library(ggplot2) d = data.frame(x=1:10, a1=rnorm(10), b1=rnorm(10)) m = melt(d, id =x) # reshape into long format qplot(x, value, data=m, geom=path, colour=variable) library(lattice) xyplot(value~x, data=m,

Re: [R] R2.11.0 - rasterImage() and barplot fill-patterns

2010-04-22 Thread baptiste auguie
Hi, This idea was also discussed when Paul Murrell first announced the grid.raster function to R-devel, http://tolstoy.newcastle.edu.au/R/e8/devel/09/12/0912.html My personal conclusion was that vector fill patterns are generally better in terms of resolution and speed. Of course the situation

Re: [R] Words appear to be bolded in the PDF output

2010-04-20 Thread baptiste auguie
Hi, Taking a wild guess, it looks to me that you might have overlaid several times the same text, plot.new() text(0.5,0.5,rep(test,10)) HTH, baptiste On 20 April 2010 08:54, chrisli1223 chri...@austwaterenv.com.au wrote: Hi all, I have written a note near each of my graphs using mtext.

Re: [R] How to embed italic Greek letters in a eps file?

2010-04-19 Thread baptiste auguie
Hi, Another option might be the tikzDevice package, which uses LaTeX to process the fonts, library(tikzDevice) tikz(standAlone=T) plot(1,1, type = 'n') mtext(side = 3, line = 2, $\\mu$) dev.off() ## system(/usr/texbin/pdflatex Rplots.tex) HTH, baptiste On 20 April 2010 07:30, Prof Brian

Re: [R] Exporting an rgl graph

2010-04-15 Thread baptiste auguie
I have seen pdf files with 3D objects embedded in it, using the U3D format, http://en.wikipedia.org/wiki/Universal_3D but I don't think there's a device for this in R; in fact there may not even exist a third-party post-processing route available at this time to bridge the gap between rgl and

Re: [R] Exporting an rgl graph

2010-04-15 Thread baptiste auguie
Apr 2010, baptiste auguie wrote: I have seen pdf files with 3D objects embedded in it, using the U3D format, http://en.wikipedia.org/wiki/Universal_3D but I don't think there's a device for this in R; in fact there may not even exist a third-party post-processing route available at this time

Re: [R] Figures within tables [slightly off-topic]

2010-04-12 Thread baptiste auguie
Hi, On 12 April 2010 22:07, Peter Jepsen p...@dce.au.dk wrote: 3. Are there R packages that can draw tables? the gplots package has a textplot() function, and the gridExtra package a tableGrob(), http://rwiki.sciviews.org/doku.php?id=tips:graphics-grid:table In theory it should be possible

Re: [R] It This data viz possible in R?

2010-04-08 Thread baptiste auguie
(stringWidth(labels)), npc)) } grid.arcText - function(...) grid.draw(arcTextGrob(...)) set.seed(1234) grid.newpage() grid.arcText() On 7 April 2010 23:13, baptiste auguie baptiste.aug...@googlemail.com wrote: The following grob might be a starting point. I couldn't find a clean way of orienting

Re: [R] square root of inverse

2010-04-08 Thread baptiste auguie
try this, install.packages(expm, repos=http://R-Forge.R-project.org;) On 8 April 2010 17:28, arindam fadikar arindam.fadi...@gmail.com wrote: On Thu, Apr 8, 2010 at 5:38 PM, David Winsemius dwinsem...@comcast.netwrote: On Apr 8, 2010, at 1:45 AM, arindam fadikar wrote:  Dear users, How

Re: [R] It This data viz possible in R?

2010-04-07 Thread baptiste auguie
Hi, Barry suggested a way to place the text labels; I would like to point out the grid.curve() function that might help in connecting the labels with nice-looking curves. I don't know of a base graphics equivalent (xspline() might come close) so it might be best to opt for Grid. HTH, baptiste

Re: [R] It This data viz possible in R?

2010-04-07 Thread baptiste auguie
, baptiste auguie baptiste.aug...@googlemail.com wrote: Hi, Barry suggested a way to place the text labels; I would like to point out the grid.curve() function that might help in connecting the labels with nice-looking curves. I don't know of a base graphics equivalent (xspline() might come close

Re: [R] Aligning text in the call to the text function

2010-04-01 Thread baptiste auguie
Hi, One option with Grid graphics, m - matrix(c( 1667,3,459, 2001, 45, 34, 1996, 2,5235), dimnames=list(c(Eric Alan, Alan,John David)), ncol=3, byrow=T) ## install.packages(gridExtra, repos=http://R-Forge.R-project.org;) library(gridExtra)

Re: [R] lattice grob

2010-03-25 Thread baptiste auguie
Hi, On 24 March 2010 23:22, Paul Murrell p.murr...@auckland.ac.nz wrote: Hi baptiste auguie wrote: Thanks Felix and Paul. I had overlooked grid.grabExpr, assuming that one had to draw on a device before grabbing the output. Now I'm not sure if there's any difference between either

Re: [R] multiple logical comparisons

2010-03-22 Thread baptiste auguie
try this one, `%ni%` - Negate(`%in%`) Best, 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 commented, minimal,

Re: [R] lattice grob

2010-03-22 Thread baptiste auguie
: What's wrong with using grid.grabExpr? p1 - xyplot(1:10 ~ 1:10) g1 - grid.grabExpr(print(p1)) I can imagine there would be potential problems to do with the plot-time aspect and layout calculations... On 19 March 2010 21:51, baptiste auguie baptiste.aug...@googlemail.com wrote: Dear

[R] lattice grob

2010-03-19 Thread baptiste auguie
Dear list, I'm trying to arrange various grid objects on a page using a frameGrob. It works fine with basic grobs (textGrob, gTree, etc.), and also with ggplot2 objects using the ggplotGrob() function. I am however stuck with lattice. As far as I understand, lattice produces a list of class

Re: [R] How to take out the content of character string

2010-03-10 Thread baptiste auguie
Hi, it's generally considered a bad practice but try this, eval(parse(text=AA)) library(fortunes) fortune(106) HTH, baptiste On 10 March 2010 07:46, jq81 jingqia...@gmail.com wrote: My question is represented by the following example. For example, I have a character string a, which is

[R] write.fortran

2010-03-10 Thread baptiste auguie
Dear all, I'm trying to write tabular data to a text file, these data will be the input of a Fortran program. The format needs to be (i7,2x,7(e15.7,2x)). I have not been able to find a clean way of producing this output with write.table. I searched for a write.fortran function similar to

Re: [R] ggplot2: Changing colour scheme for bar plot filling?

2010-03-10 Thread baptiste auguie
Hi, last_plot() + scale_fill_grey() should do it HTH, baptiste On 10 March 2010 09:46, Johannes Graumann johannes_graum...@web.de wrote: Hello, I'd like to sitch to a monochrome/bw color-palette for the filling of geom_bar-bars (produced via qplot as in the example below). Hours of

Re: [R] ggplot2: Changing colour scheme for bar plot filling?

2010-03-10 Thread baptiste auguie
On Wednesday 10 March 2010 10:29:05 baptiste auguie wrote: Hi, last_plot() + scale_fill_grey() should do it HTH, baptiste On 10 March 2010 09:46, Johannes Graumann johannes_graum...@web.de wrote: Hello, I'd like to sitch to a monochrome/bw color-palette for the filling of geom_bar-bars

Re: [R] write.fortran

2010-03-10 Thread baptiste auguie
Thanks, it is indeed a bit cleaner. I was hoping for a more generic solution but I guess people use cat() and sprintf() in such cases. Thanks, baptiste On 10 March 2010 12:46, Berend Hasselman b...@xs4all.nl wrote: baptiste auguie-5 wrote: This is a lot easier  for(k in seq(1,nrow(m

Re: [R] write.fortran

2010-03-10 Thread baptiste auguie
, \n), c(1, 6, 1)), file = ) On Wed, Mar 10, 2010 at 7:52 AM, baptiste auguie baptiste.aug...@googlemail.com wrote: Thanks, it is indeed a bit cleaner. I was hoping for a more generic solution but I guess people use cat() and sprintf() in such cases. Thanks, baptiste On 10 March 2010 12:46

Re: [R] data.frame question

2010-03-07 Thread baptiste auguie
Hi, try this, data.frame(x,as.numeric(x %in% y)) HTH, baptiste On 7 March 2010 21:06, joseph jdsan...@yahoo.com wrote: hello can you show me how to create a data.frame from two factors x and y. column 1 should be equal to x and column 2 is 1 if it is common to y and 0 if it is not.

Re: [R] how to make this sequence: 1,2,3,4,5,4,3,2,1

2010-03-05 Thread baptiste auguie
c(x - 1:5, rev(x[-length(x)])) On 5 March 2010 07:04, kensuguro magronb...@gmail.com wrote: I'm just beginning R, with book Using R for Introductory Statistics, and one of the early questions has me baffled.  The question is, create the sequence: 1,2,3,4,5,4,3,2,1 using seq() and rep().

Re: [R] Three most useful R package

2010-03-03 Thread baptiste auguie
Hi, The 3 packages I load most often are my own; typically I make a new package for every new job. It automatically loads other packages as dependencies (top-ranked are ggplot2, reshape, plyr) as well as my data and functions I'm currently working with. If some functions evolve further towards a

Re: [R] Preserving lists in a function

2010-02-27 Thread baptiste auguie
Hi, I think I would follow this approach too, using updatelist() from the reshape package, updatelist - function (x, y) { common - intersect(names(x), names(y)) x[common] - y[common] x } myfunction=function(list1=NULL, list2=NULL, list3=NULL){ list1=updatelist(list(variable1=1,

Re: [R] Preserving lists in a function

2010-02-27 Thread baptiste auguie
Point well taken --- grid::gpar() is also a good example; I'll make use of your suggestion in my future coding. Best, baptiste On 27 February 2010 15:02, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: On Sat, Feb 27, 2010 at 11:29 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote:

Re: [R] Plotting a Trivial Matrix

2010-02-26 Thread baptiste auguie
Hi, A minimalist example using Grid graphics, library(RGraphics) bwImage - function(m, cols=c(white, black), draw=TRUE, gp=gpar()){ g - imageGrob(nrow(m), ncol(m), cols=cols[m+1], gp=gp) if(draw) grid.draw(g) return(g) } m - matrix(rnorm(200) 0,

Re: [R] Plotting a Trivial Matrix

2010-02-26 Thread baptiste auguie
On 26 February 2010 11:12, Lorenzo Isella lorenzo.ise...@gmail.com wrote: Thanks Augustine and Jim for the prompt reply. You both answered my question. To avoid another post, I would simply like to know if something along these lines is doable also with ggplot2. Many thanks Lorenzo

Re: [R] How to fill in a region with different patterns?

2010-02-25 Thread baptiste auguie
Hi, If you are curious you might like to try a highly experimental Grid function I wrote some time ago, library(grid) source(http://gridextra.googlecode.com/svn/trunk/R/patternGrob.r;) grid.newpage() grid.pattern(x=seq(1/6, 5/6, length=6), width=unit(1/8,npc), height=unit(0.5,npc),

Re: [R] Exporting Graphs

2010-02-21 Thread baptiste auguie
Hi, just to make sure, you didn't forget to close the device with dev.off() ? baptiste On 21 February 2010 20:48, Karthik kwr...@gmail.com wrote: Hello Tal, This is the code. hist(rnorm(100)) jpeg(histogram.jpeg) --- Even when I decrease the

Re: [R] Bind field of a list

2010-02-19 Thread baptiste auguie
Hi, Try this, unlist(test) or do.call(c, test) HTH, baptiste On 19 February 2010 15:19, statquant colin.uman...@barcap.com wrote: Hello all I am new in R and so easy stuff are difficult... let say that I have a list test - list(a=c(x,v),b=c(n,m)) how can I without a loop get test$a

Re: [R] evaluate variable within expression - how?

2010-02-14 Thread baptiste auguie
Hi, Try with bquote, plot.new() myText - some text text(.5, .5, bquote(bold(.(myText basically, bquote( .(myText) ) performs the substitution before applying bold() (see ?bquote). HTH, baptiste On 14 February 2010 17:36, Mark Heckmann mark.heckm...@gmx.de wrote: #  I want to plot bold

Re: [R] Problems with boxplot in ggplot2:qplot

2010-02-14 Thread baptiste auguie
Hi, it's hard to tell what's wrong without a reproducible example, but I noted two things: - AFAIK there is no plot method for ggplot2. You probably meant print(p) instead - if you map x to factor(month), I think it will be incompatible with your xlim values range(month). HTH, baptiste On 14

Re: [R] unexpected results with higher-order functions and lapply

2010-02-14 Thread baptiste auguie
Hi, I believe it's lazy evaluation. See ?force HTH, baptiste On 14 February 2010 20:32, Jyotirmoy Bhattacharya jyotir...@jyotirmoy.net wrote: I want to use lapply and a function returning a function in order to build a list of functions. genr1 - function(k) {function() {k}} l1 -

Re: [R] Flattening Graphics

2010-02-11 Thread baptiste auguie
Hi, On 11 February 2010 22:14, Paul Murrell p.murr...@auckland.ac.nz wrote: Hi baptiste auguie wrote: Hi, You could try the grid.grab() function in R devel if your graphics use the Grid package. It will read the graphical output as a bitmap which grid.grab() does NOT grab a bitmap

Re: [R] Flattening Graphics

2010-02-10 Thread baptiste auguie
Hi, You could try the grid.grab() function in R devel if your graphics use the Grid package. It will read the graphical output as a bitmap which you can then export in a multipage pdf. It may not be really flattening per se but that would definitely help with the viewing speed. HTH, baptiste

Re: [R] color blending and transparency

2010-02-03 Thread baptiste auguie
Hi, Adding two semi-transparent colours results in non-intuitive colour mixing (a mystery for me anyway). Is it additive (light), substractive (paint), or something else? Consider the following example, depending on the order of the two layers the overlap region is either purple or dark red. I

[R] group factor levels

2010-02-03 Thread baptiste auguie
Dear list, I cannot find an elegant solution to this problem. I have a factor f containing several levels (5) and I wish to create a new factor of the same length with fewer levels (2). This new factor should therefore group together some levels of the original data. Ideally this grouping would

Re: [R] group factor levels

2010-02-03 Thread baptiste auguie
As always the question seems silly after you've learned the answer! Thanks a lot, baptiste On 3 February 2010 15:06, Petr PIKAL petr.pi...@precheza.cz wrote: # order levels f.t-factor(f, levels=disorder) # change levels levels(f.t) - new.lev all.equal(f.t,f2) [1] TRUE Regards Petr

Re: [R] color blending and transparency

2010-02-03 Thread baptiste auguie
Murdoch murd...@stats.uwo.ca wrote: On 03/02/2010 8:50 AM, Ken Knoblauch wrote: baptiste auguie baptiste.auguie at googlemail.com writes: Adding two semi-transparent colours results in non-intuitive colour mixing (a mystery for me anyway). Is it additive (light), substractive (paint), or something

Re: [R] color blending and transparency

2010-02-03 Thread baptiste auguie
later (I haven't found any documentation on this so far). Thanks, baptiste On 3 February 2010 16:38, Duncan Murdoch murd...@stats.uwo.ca wrote: On 03/02/2010 9:38 AM, baptiste auguie wrote: That makes perfect sense, thank you, except that I'm not sure where the white comes from when I set

Re: [R] color blending and transparency

2010-02-03 Thread baptiste auguie
Thanks for this complementary information. My head itches slightly when reading about these virtual layers with unidirectional absorption and reflection properties but I guess that's imputable to my personal background as a physicist. I still have a few questions, - is this behavior documented?

Re: [R] parsing files for plot

2010-01-30 Thread baptiste auguie
Hi, Hadley recently proposed a strategy using plyr for a very similar problem, listOfFiles - list.files() names(listOfFiles) - basename(listOfFiles) library(plyr) d - ldply(listOfFiles, scan) Even if you don't want to use plyr, it's always better to group things in a list rather than clutter

Re: [R] parsing files for plot

2010-01-30 Thread baptiste auguie
code: I get an error like: Read 2652 items Read 3310 items Read 1096 items Read 2177 items Read 11387 items Read 12503 items Error in list_to_dataframe(res, attr(.data, split_labels)) :   Results are not equal lengths hmmh? Maxim 2010/1/30 baptiste auguie

Re: [R] evaluating expressions with sub expressions

2010-01-29 Thread baptiste auguie
Hi, Would this do as an alternative syntax? g1 - quote(1/Tm) mat - list(0, bquote(f1*s1*.(g1))) vals - data.frame(f1=1, s1=.5, Tm=2) sapply(mat, eval, vals) HTH, baptiste On 29 January 2010 17:51, Jennifer Young jennifer.yo...@math.mcmaster.ca wrote: Hallo I'm having trouble figuring out

Re: [R] ggplot2 theme for custom point colors?

2010-01-27 Thread baptiste auguie
Hi, I remember asking a similar question some time ago, I don't know if the matter has evolved since then, http://groups.google.com/group/ggplot2/browse_frm/thread/a3df8a0d1ee335fb/e3bedd50fb9bd567?lnk=gstq=theme#e3bedd50fb9bd567 There's also set_default_scale, somewhat related to your

Re: [R] color matrix

2010-01-27 Thread baptiste auguie
Hi, It's easy with ggplot2, cols = matrix(c(#F7FBFF, #DEEBF7, #C6DBEF, #9ECAE1, #6BAED6, #4292C6, #2171B5, #08519C ,#08306B), ncol=3) library(ggplot2) m = melt(cols) qplot(factor(X1),factor(X2),data=m, fill=value, geom=tile) + scale_fill_identity() HTH, baptiste 2010/1/27 evgeny55

Re: [R] Fwd: Re: Graph color

2010-01-26 Thread baptiste auguie
Hi, Try this, x - seq(0, 10, len = 100) y - jitter(sin(x), 1000) old.par - par() par(bg=grey(0.5)) plot(x, y, new = TRUE, t = n) lims - par(usr) plot(x, y, col = 1, panel.first = { rect(lims[1], lims[3], lims[2], lims[4], col = lightblue) }) HTH, baptiste 2010/1/26

Re: [R] column selection in list

2010-01-22 Thread baptiste auguie
Hi, Try this, a = replicate(3, data.frame(x=1:10, y=rnorm(10)), simplify=FALSE) lapply(a, [, y) HTH, baptiste 2010/1/22 Ivan Calandra ivan.calan...@uni-hamburg.de: Hi everybody! I have a (stupid) question but I cannot find a way to do it! I have a list like: SPECSHOR_tx_Asfc $cotau  

Re: [R] about loops

2010-01-21 Thread baptiste auguie
Hi, One approach could be a while loop as follows. Note that your circle should have radius 0.5 if I understood the problem correctly. N - 5 npoints - 0 ntests - 0 points.in.circle - matrix(NA, ncol=2, nrow=N) while (npoints N) { test.point - runif(2, -0.5, 0.5) # generate new point in 2D

Re: [R] How do I juxtapose two lattice graphs with common X axes such that the X axes line up?

2010-01-20 Thread baptiste auguie
Hi, try c.trellis() from the latticeExtra package. HTH, baptiste 2010/1/20 George Chen glc...@stanford.edu: Hello, I would like to juxtapose two lattice graphs with common X axes such that the X axes line up.  I am using plot right now but the edges are not neat and it would be nice if

Re: [R] exporting text output to pdf

2010-01-19 Thread baptiste auguie
Hi, You could play with the splitTextGrob() function from the RGraphics package, string - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque leo ipsum, ultricies scelerisque volutpat non, volutpat et nulla. Curabitur consequat ullamcorper tellus id imperdiet. Duis semper malesuada

Re: [R] call R with un expression (String)?

2010-01-19 Thread baptiste auguie
Hi, ?eval seems like a good candidate HTH, baptiste 2010/1/15 Jiiindo jiin...@yahoo.com: Hello all, I want to call R from java. And I have a expression in Java as a String, example : (variable 1 + variable 2)* variable 3 and i want R calculate this expression. How can I do? ex: Java

Re: [R] apply command

2010-01-19 Thread baptiste auguie
Hi, I think you could use iapply (search the archives) or the plyr package to save you from transposing the result. HTH, baptiste 2010/1/19 marco salvini marco.salv...@gmail.com: Can you please help on the issue? I using the apply command on a matrix below the example: Create a vector x

Re: [R] expand.grid game

2010-01-13 Thread baptiste auguie
It did take me a good night's sleep to understand it. I was stuck with the exact same question but I see now how the remaining balls are shared among all 8 urns (therefore cases with 11, 12, 13, ... 17 balls are also dealt with). Thanks again, baptiste 2010/1/12 Rolf Turner

Re: [R] expand.grid game

2010-01-12 Thread baptiste auguie
] On Behalf Of Brian Diggs Sent: Thursday, December 31, 2009 3:08 PM To: baptiste auguie; David Winsemius Cc: r-help Subject: Re: [R] expand.grid game baptiste auguie wrote: 2009/12/19 David Winsemius dwinsem...@comcast.net: On Dec 19, 2009, at 9:06 AM, baptiste auguie wrote: Dear list

Re: [R] postscript, greek lellters

2010-01-09 Thread baptiste auguie
Hi, Something like this maybe, plot.new() lab = expression(bar(T)*(*-x* ; *alpha*)-G*(*x* ; *alpha* , *J*)) text(0.5,0.5,lab) ?plotmath HTH, baptiste 2010/1/8 bernardo lagos alvarez blacert...@gmail.com: Dear useRs, How can I, writting the correct greek letter using postscrip or pdf

Re: [R] [R-pkgs] fortunes: 250th fortune

2010-01-07 Thread baptiste auguie
Hi, Thank you for this fun package. I recently posted a related question on R-help that seemed to pass unnoticed. Basically, I suggested that the functionality of fortunes could be extended to R FAQ entries, also allowing contributed packages to provide their own (fortune or) faq data file. My

Re: [R] xyplot: problems with column names legend

2010-01-03 Thread baptiste auguie
Hi, Using backticks might work to some extent, library(lattice) `my variable` = 1:10 y=rnorm(10) xyplot(`my variable` ~ y) but if your data is in a data.frame the names should have been converted, make.names('my variable') [1] my.variable HTH, baptiste 2010/1/3 Jay josip.2...@gmail.com:

Re: [R] Axis Labels for Compound Plots in ggplot2

2009-12-30 Thread baptiste auguie
Hi, You can set up a Grid layout with one viewport at the bottom and another on the left and use grid.text to add your labels. An example is given below using grid.pack. The gridExtra package provides a convenient wrapper for these regular arrangements of plots, ##library(gridExtra)

Re: [R] ggplot2, building a simple formula interface

2009-12-29 Thread baptiste auguie
Hi, Try print(p) instead of plot(p) HTH, baptiste 2009/12/29 Bryan Hanson han...@depauw.edu: I¹m trying to build a simple formula interface to work with a function using ggplot2. The following scheme ³works² up until the plot(p) request, at which point there are complaints about xlim¹s and

Re: [R] subsetting by groups, with conditions

2009-12-29 Thread baptiste auguie
Hi, I think you can also use plyr for this, dft - read.table(textConnection(P1idVeg1Veg2AreaPoly2 P2ID 1 p p 1 1 1 p p 1.5 2 2 p p 2 3 2 p h 3.5 4),

Re: [R] Histogram/BoxPlot Panel

2009-12-29 Thread baptiste auguie
Hi, Here is some artificial data followed by minimal ggplot2 and lattice examples, makeUpData - function(){ data.frame(x=sample(letters[1:4], 100, repl=TRUE), y=rnorm(100)) } datasets - replicate(15, makeUpData(), simplify=FALSE) names(datasets) - paste(dataset, seq_along(datasets), sep=)

Re: [R] Histogram/BoxPlot Panel

2009-12-29 Thread baptiste auguie
as a book. Lattice also has a dedicated book, and a companion website with the figures, http://r-forge.r-project.org/projects/lmdvr/ HTH, baptiste 2009/12/29 baptiste auguie baptiste.aug...@googlemail.com: Hi, Here is some artificial data followed by minimal ggplot2 and lattice examples

Re: [R] Scaling error

2009-12-27 Thread baptiste auguie
Hi, Try this, x - matrix(1:9, ncol=3, byrow=T) sca - c(2.5, 1.7, 3.6) x %*% diag(1/sca) HTH, baptiste 2009/12/27 Muhammad Rahiz muhammad.ra...@ouce.ox.ac.uk: Hi useRs, I ran into an inconsistent output problem again. Here is the simplify illustration I've got a matrix as follows x

Re: [R] String question

2009-12-23 Thread baptiste auguie
Will this do? temp - paste(m, 1:3, sep=,collapse=,) HTH, baptiste 2009/12/23 Knut Krueger r...@krueger-family.de: Hi to all I need a string like temp - paste(m1,m2,m3,sep=,) But i must know how many items are in the string,afterwards the other option would be to use a vector temp -

Re: [R] String question

2009-12-23 Thread baptiste auguie
Isn't paste doing exactly this? temp - c(November, December,Monday,Tuesday) paste(temp, collapse=,) # November,December,Monday,Tuesday HTH, baptiste 2009/12/23 Ted Harding ted.hard...@manchester.ac.uk: On 23-Dec-09 11:08:02, Knut Krueger wrote: Jim Lemon schrieb: Not as easy as I thought

Re: [R] expand.grid game

2009-12-21 Thread baptiste auguie
participated, I have learned interesting things from a seemingly innocuous question. Best regards, baptiste 2009/12/21 Robin Hankin rk...@cam.ac.uk: Hi library(partitions) jj - blockparts(rep(9,8),17) dim(jj) gives 318648 HTH rksh baptiste auguie wrote: Dear list

Re: [R] expression()

2009-12-20 Thread baptiste auguie
Hi, try this, ylab = expression(Temperature~(degree*F)) ?plotmath baptiste 2009/12/20 Kim Jung Hwa kimhwamaill...@gmail.com: Hi All, I'm wondering if its possible to write degree in symbol. I would like y-label as Temperature (degreeF). where degree should be in symbols. Thanks in

[R] basic proto question

2009-12-20 Thread baptiste auguie
Dear list, I made the following example of a proto object that contains some data and a spline interpolation. I don't understand why test$predict() fails with this error message: Error: evaluation nested too deeply: infinite recursion / options(expressions=)? Best regards, baptiste test -

Re: [R] basic proto question

2009-12-20 Thread baptiste auguie
mean to refer to stats::predict.  Change the line that calls predict to: stats::predict(.$spline(), x.fine) On Sun, Dec 20, 2009 at 11:49 AM, baptiste auguie baptiste.aug...@googlemail.com wrote: Dear list, I made the following example of a proto object that contains some data and a spline

Re: [R] How to rotate an axis?

2009-12-20 Thread baptiste auguie
Hi, Do you want a ternary plot? http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=34 It's easy to rotate an axis with Grid graphics, library(grid) pushViewport(viewport(0.5,0.5, width=0.5, height=unit(3, lines))) grid.xaxis(at=seq(-0.5,0.5,by=0.1), vp=viewport(x=1, angle=-60)) HTH,

[R] expand.grid game

2009-12-19 Thread baptiste auguie
Dear list, In a little numbers game, I've hit a performance snag and I'm not sure how to code this in C. The game is the following: how many 8-digit numbers have the sum of their digits equal to 17? The brute-force answer could be: maxi - 9 # digits from 0 to 9 N - 5 # 8 is too large test - 17

Re: [R] expand.grid game

2009-12-19 Thread baptiste auguie
2009/12/19 David Winsemius dwinsem...@comcast.net: On Dec 19, 2009, at 9:06 AM, baptiste auguie wrote: Dear list, In a little numbers game, I've hit a performance snag and I'm not sure how to code this in C. The game is the following: how many 8-digit numbers have the sum of their digits

Re: [R] expand.grid game

2009-12-19 Thread baptiste auguie
)}) user system elapsed 34.050 1.109 35.791 I'm surprised by idx-c(idx,i), isn't that considered a sin in the R Inferno? Presumably growing idx will waste time for large N. Thanks, baptiste 2009/12/19 David Winsemius dwinsem...@comcast.net: On Dec 19, 2009, at 1:36 PM, baptiste auguie wrote

Re: [R] expand.grid game

2009-12-19 Thread baptiste auguie
for the list] 2009/12/19 David Winsemius dwinsem...@comcast.net: On Dec 19, 2009, at 2:10 PM, David Winsemius wrote: On Dec 19, 2009, at 1:36 PM, baptiste auguie wrote: 2009/12/19 David Winsemius dwinsem...@comcast.net: On Dec 19, 2009, at 9:06 AM, baptiste auguie wrote: Dear list

Re: [R] mutlidimensional in.convex.hull (wasmultidimensionalpoint.in.polygon??)

2009-12-18 Thread baptiste auguie
Hi, Excellent, thanks for doing this! I had tried the 2D case myself but I was put off by the fact that Octave's convhulln had a different ordering of the points to R's geometry package (an improvement to Octave's convhulln was made after it was ported to R). I'm not sure how you got around this

Re: [R] problem with a densityplot

2009-12-16 Thread baptiste auguie
FAQ: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f you need to print() HTH, baptiste 2009/12/16 c...@autistici.org c...@autistici.org: Hi, i have a script how i launch lattice to make a densityplot. in the script: jpeg(file=XXX.jpg)

[R] fortune-like FAQ search

2009-12-16 Thread baptiste auguie
Dear list, I'm not so familiar with the internals of the fortunes package, but I really like the interface. I was wondering if someone had implemented a similar functionality to parse the entries of the R FAQ http://cran.r-project.org/doc/FAQ/R-FAQ.html . Say, if I was to answer a question Why

Re: [R] Combinations

2009-12-14 Thread baptiste auguie
Hi, Try this, apply(expand.grid(letters[1:3], letters[24:26]), 1, paste,collapse=) [1] ax bx cx ay by cy az bz cz ?expand.grid HTH, baptiste 2009/12/14 Amelia Livington amelia_living...@yahoo.com: Dear R helpers, I am working on the scenario analysis pertaining to various interest rates.

Re: [R] code for [[.data.frame

2009-12-13 Thread baptiste auguie
`[[.data.frame` and more generally see Rnews Volume 6/4, October 2006 Accessing the Sources. HTH, baptiste 2009/12/13 Guillaume Yziquel guillaume.yziq...@citycable.ch: Hello. I'm currently trying to wrap up data frames into OCaml via OCaml-R, and I'm having trouble with data frame

Re: [R] mutlidimensional in.convex.hull (was multidimensional point.in.polygon??)

2009-12-11 Thread baptiste auguie
2009/12/10 Charles C. Berry cbe...@tajo.ucsd.edu: [snipped] Many? set.seed(1234) ps - matrix(rnorm(4000),ncol=4) phull -  convhulln(ps) xs - matrix(rnorm(1200),ncol=4) phull2 - convhulln(rbind(ps,xs)) nrp - nrow(ps) nrx - nrow(xs) outside - unique(phull2[phull2nrp])-nrp done - FALSE

Re: [R] get the enclosing function name

2009-12-11 Thread baptiste auguie
Hi, .NotYetImplemented gives an example, function () stop(gettextf('%s' is not implemented yet, as.character(sys.call(sys.parent())[[1L]])), call. = FALSE) environment: namespace:base HTH, baptiste 2009/12/11 Hao Cen h...@andrew.cmu.edu: Hi, Is there a way to get the enclosing function

Re: [R] multidimensional point.in.polygon??

2009-12-10 Thread baptiste auguie
- baptiste auguie baptiste.aug...@googlemail.com wrote in message news:de4e29f50912040550m71fbffafnfa1ed6e0f4451...@mail.gmail.com... Hi, Yet another one of my very naive ideas on the subject: maybe you can first evaluate the circumscribed and inscribed

Re: [R] Avoid for-loop in creating data.frames

2009-12-10 Thread baptiste auguie
Hi, Is the following close enough? apply(set2, 2, function(x) x[is.na(x)]) HTH, baptiste 2009/12/10 Andreas Wittmann andreas_wittm...@gmx.de: Dear R-users, after several tries with lapply and searching the mailing list, i want to ask, wheter and how it is possibly to avoid the for-loop in

Re: [R] Greek symbols on ylab= using barchart() {Lattice}

2009-12-09 Thread baptiste auguie
Hi, try this, barchart(1:2, ylab=expression(mu*g/m^3)) ?plotmath baptiste 2009/12/9 Peng Cai pengcaimaill...@gmail.com: Hi All, I'm trying to write ug/m3 as y-label, with greek letter mu replacing u AND 3 going as a power. These commands works in general: plot.new() text(0.5, 0.5,

<    1   2   3   4   5   6   7   8   >