[R] Lattice equivalent to ggplot function

2016-10-24 Thread Sébastien Bihorel
Hi, The ggplot2 includes the very convenient stat_summary function to summarize y variable data and plot this summary statistic in a y vs x graph. I need to implement similar functionality in a lattice-based framework. Googling this topic using keywords like lattice, equivalent, stat_summary, did

Re: [R] Information about font

2014-07-11 Thread Sébastien Bihorel
If I may ask, how can I know the path to the font file(s) used by R when it generates the png files with the Helvetica font? Thanks On Thu, Jul 10, 2014 at 12:21 AM, David Winsemius dwinsem...@comcast.net wrote: On Jul 9, 2014, at 7:47 PM, Sébastien Bihorel wrote: Hi, I have this set

Re: [R] Information about font

2014-07-10 Thread Sébastien Bihorel
Hi David, Thank you for your response. I use png devices to create my plots. Looking at ?pdfFonts and ?Type1Font, I believe these fonts only apply to pdf devices. Additionally, ?grid::gpar and ?png are not specific about default font options. Any suggestions? Sebastien On Thu, Jul 10, 2014

Re: [R] Information about font

2014-07-10 Thread Sébastien Bihorel
Correction The warnings section in ?png indicate that Helvetica is the default font. Now I need to verify if this is true for my plot and find out where this font is located on my system On Thu, Jul 10, 2014 at 8:54 AM, Sébastien Bihorel pomc...@free.fr wrote: Hi David, Thank you for your

[R] Information about font

2014-07-09 Thread Sébastien Bihorel
Hi, I have this set of R scripts which are ran on a linux box and create plots with the lattice package. I do not specify any custom font family, so I believe that whatever is the default font on my system is used in the plot. 1- how can I know which is the default font used in my plots? 2- is

[R] Problem of scope

2013-12-27 Thread Sébastien Bihorel
Hi, I have a problem of variable scope illustrated by the following example (this examples greatly simplifies the actual code I am working on but I unfortunately cannot share it). I have two functions, funa and funb: funb is called within funa. The goal of funb is to modify variables created

Re: [R] Problem of scope

2013-12-27 Thread Sébastien Bihorel
Thank you Uwe. I always forget about how environments are embedded within each other. On Fri, Dec 27, 2013 at 9:33 AM, Sébastien Bihorel pomc...@free.fr wrote: Hi, I have a problem of variable scope illustrated by the following example (this examples greatly simplifies the actual code I

[R] How to automate the detection of break points for use in cut

2011-12-06 Thread Sébastien Bihorel
Dear R-users, I would like to know if there is a function (in base R or the extension packages) that would automatically detect the break points in a vector x for later use in the cut function. The idea is to determine the boundaries of the n intervals (n=1) delimiting clusters of data points

Re: [R] How to automate the detection of break points for use in cut

2011-12-06 Thread Sébastien Bihorel
Obviously, cut would do the job if one knows the number of intervals in advance, which I assume I won't. I guess what I'm looking for is a function that figures out the number of intervals and their boundaries. Sebastien On Tue, Dec 6, 2011 at 3:29 AM, Sébastien Bihorel pomc...@free.fr wrote

[R] Argument validation within functions

2011-12-06 Thread Sébastien Bihorel
Adding on Michael comment: If your trap all conditions that render your main code invalid at the beginning of your code, the main code does not have to be within the else part of a if else statement. For instance: myf - function(a,b,c){ if ( ! (is.numeric(a) (a=0 a=1) ) ){ stop('a is

Re: [R] How to automate the detection of break points for use in cut

2011-12-06 Thread Sébastien Bihorel
I forgot to post my reply to Duncan's response on the list. On Tue, Dec 6, 2011 at 7:56 AM, Sébastien Bihorel pomc...@free.fr wrote: Thanks for the link Duncan, Given the number of methods and links listed in the Cluster task view, things are looking a bit more complex than I thought... I'll

Re: [R] How to call a function defined within another function

2011-10-20 Thread Sébastien Bihorel
Thanks Uwe for reply. The license is actually a problem: my package is distributed with a LGPL3 license, which is incompatible with GPL-2. I'll try to find a work-around. Sebastien 2011/10/20 Uwe Ligges lig...@statistik.tu-dortmund.de On 19.10.2011 22:08, Sébastien Bihorel wrote: Dear

Re: [R] How to call a function defined within another function

2011-10-20 Thread Sébastien Bihorel
Thanks for the hack Gabor! That works just fine... (I guess until the step.gam function is re-structured :D) On Thu, Oct 20, 2011 at 9:20 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Wed, Oct 19, 2011 at 4:08 PM, Sébastien Bihorel pomc...@free.fr wrote: Dear R-users, I would

[R] Warning messages upon new package loading

2011-09-30 Thread Sébastien Bihorel
Dear R-users, The following warning messages are displayed when I require a new package that I am currently developing. Everything seems to work just fine though, so I am wondering how to get rid of the warnings. Warning messages: 1: Class frame is defined (with package slot 'kiwixposepreprod')

[R] How to modify the dot-dot-dot argument using level names instead of position

2011-08-31 Thread Sébastien Bihorel
Dear R-users, In the R internals manual, it is said that one can extract the elements of the dot-dot-dot argument using the special symbols ..1 or ..2. It seems to work just fine but I was wondering if there is a way one can extract or modify the content of the dot-dot-dot argument using a level

Re: [R] How to modify the dot-dot-dot argument using level names instead of position

2011-08-31 Thread Sébastien Bihorel
the content of dot-dot-dot by any means? Thank On Wed, Aug 31, 2011 at 9:25 AM, Sébastien Bihorel pomc...@free.fr wrote: Dear R-users, In the R internals manual, it is said that one can extract the elements of the dot-dot-dot argument using the special symbols ..1 or ..2. It seems to work just fine

Re: [R] How to modify the dot-dot-dot argument using level names instead of position

2011-08-31 Thread Sébastien Bihorel
Thanks Duncan On Wed, Aug 31, 2011 at 9:43 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 31/08/2011 9:41 AM, Sébastien Bihorel wrote: Hi, I thought ..2- 1 was a correct way to modify the content of the 2nd level of dot-dot-dot because it did not return any error message. However

Re: [R] Groups and bwplot

2011-08-22 Thread Sébastien Bihorel
mybwplot('Type','uptake',myCO2,'year') # works On Sat, Aug 20, 2011 at 1:35 PM, Sébastien Bihorel pomc...@free.fr wrote: Thanks for your input and this link. I realize that there was a typo in my example code that impacted the group argument... That's king of stupid. However, even

[R] Groups and bwplot

2011-08-20 Thread Sébastien Bihorel
Dear R-users, A while ago, Deepayan Sarkar suggested some code that uses the group argument in bwplot to create some 'side-by-side' boxplots (https://stat.ethz.ch/pipermail/r-help/2010-February/230065.html). The example he gave was relatively specific and I wanted to generalize his approach into

Re: [R] Groups and bwplot

2011-08-20 Thread Sébastien Bihorel
://stat.ethz.ch/pipermail/r-help/2011-August/286707.html) on how to pass group parameter. Weidong Gu On Sat, Aug 20, 2011 at 6:59 AM, Sébastien Bihorel pomc...@free.fr wrote: Dear R-users, A while ago, Deepayan Sarkar suggested some code that uses the group argument in bwplot to create some

[R] Grid unit width and font face

2011-08-12 Thread Sébastien Bihorel
Dear R-users, When one defines a grid unit object using the 'strwidth' dimension, it seems that the default plain font is assumed as the following example illustrates. Is there a way to either make use of a font option when creating a unit object or to know the factor that exists between the

[R] deSolve output

2011-08-12 Thread Sébastien Bihorel
Hi, Try with the following ODE function. This should give you an extra column with the derivative of G in your THAAC matrix. degradation = function (t, state, parameters) {  with(as.list(c(state, parameters)),    {dG = (-a*(t+i)^b)*(G)    list(c(dG),dG=dG)    }) } Any additional variables that

Re: [R] Need to compute density as done by panel.histogram

2011-08-03 Thread Sébastien Bihorel
Thank you very much Peter, I'm going to dig deeper into the code of the functions you've listed. On Wed, Aug 3, 2011 at 6:57 AM, Peter Ehlers ehl...@ucalgary.ca wrote: On 2011-08-02 11:51, Sébastien Bihorel wrote: Hi, This might be a simple problem but I don't know how to calculate

[R] How to calculate the number of time a given string can be displayed in the width of a grid viewport

2011-08-03 Thread Sébastien Bihorel
Dear R users, I am trying to determine how many characters can be displayed within the width of an open grid viewport. Unfortunately, the arithmetic operation that seems obvious in this case is be permitted with unit objects (see example below). Although it isa brut force way to get this number

[R] How to calculate the number of times a given string can be displayed in the width of a grid viewport

2011-08-03 Thread Sébastien Bihorel
There was too many spelling mistakes in my original post so I have decided to re-submit it. So here is it Dear R users, I am trying to determine how many characters can be displayed within the width of an open grid viewport. Unfortunately, the arithmetic operation that seems obvious in this case

[R] Need to compute density as done by panel.histogram

2011-08-02 Thread Sébastien Bihorel
Hi, This might be a simple problem but I don't know how to calculate a random variable density the way panel.histogram does it before it creates the actual density rectangles. The documentation says that it uses the density function but the actual code suggests that the hist.constructor function

[R] How to adjust y-axis when using panel.densityplot within histogram function

2011-07-27 Thread Sébastien Bihorel
Hi I would like to superimpose group-specific densityplots on top of an overall histogram using panel.histogram and panel.densityplot. Furthermore, I would like to automatically adjust the range of the y-axis to take into account the ranges of both histogram and densityplot. This last part is

Re: [R] How to adjust y-axis when using panel.densityplot within histogram function

2011-07-27 Thread Sébastien Bihorel
that allow to draw densityplots only when it is appropriate (ie when the type of the histogram is set to density). Sebastien On Wed, Jul 27, 2011 at 10:01 AM, David Winsemius dwinsem...@comcast.netwrote: On Jul 27, 2011, at 9:15 AM, Sébastien Bihorel wrote: Hi I would like to superimpose group

[R] Package check issue: Rprofile.site is not used

2011-04-21 Thread Sébastien Bihorel
Dear R-users, I am having some issues with a package I am working on (using R 2.12.1 in a Linux environment) and would like to have your opinions/advises. My package - let's call it mypackage for the purpose of this email - passes all checks of R CMD check, except for the following failure

Re: [R] Define ylim in lattice plot based upon panel function output

2011-04-19 Thread Sébastien Bihorel
AM, Sébastien Bihorel pomc...@free.fr wrote: Dear R-users, By default, the xyplot function automatically defines the axis ranges based upon the content of y and x variables. However, when one includes some calls to other panel.something functions in the panel argument, the results

[R] Define ylim in lattice plot based upon panel function output

2011-04-18 Thread Sébastien Bihorel
Dear R-users, By default, the xyplot function automatically defines the axis ranges based upon the content of y and x variables. However, when one includes some calls to other panel.something functions in the panel argument, the results might be out of range and not show up in the final graphs

Re: [R] Units and dimensions in grid object

2011-03-10 Thread Sébastien Bihorel
...@auckland.ac.nzwrote: Hi On 5/03/2011 9:37 a.m., Sébastien Bihorel wrote: Dear R-users, As far as I understand, when one defines the width of a rectGrob call using a 'npc' unit, the width of the object is proportional to the width of the current viewport. Is there a way to refer to the height

[R] Units and dimensions in grid object

2011-03-04 Thread Sébastien Bihorel
Dear R-users, As far as I understand, when one defines the width of a rectGrob call using a 'npc' unit, the width of the object is proportional to the width of the current viewport. Is there a way to refer to the height (or width) of the viewport when defining the width (or height) of the

Re: [R] Discrepancies in run times

2011-02-28 Thread Sébastien Bihorel
that you can share that has the same behavior. My guess is that you will answer your own question as you try to do that. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Sébastien Bihorel Sent: Tuesday, February 22, 2011 12:16 PM

[R] Discrepancies in run times

2011-02-22 Thread Sébastien Bihorel
Dear R-users, I am in the process of creating new custom functions and am quite puzzled by some discrepancies in execution time when I run some R scripts that call those new functions. So here is the situation: - let's assume I have created two custom functions, called myg and myf; - myg is

[R] darcs patch: Apply on data frame

2011-02-17 Thread Sébastien Bihorel
Hi, You need to add parentheses around your return argument. (Please, note that your example is not successfully because of data problem). ranksum - function(a){ g1 - c(1, 2, 3) g2 - c(4, 5, 6, 7, 8, 9, 10, 11, 12) c - wilcox.test(a[g1], a[g2]) return(c$p.value) } [[alternative

[R] Function scope issues

2011-02-16 Thread Sébastien Bihorel
Dear R-users, I have some questions about the scope of functions, which I would like to illustrate with the following example: ### First example require(Hmisc) combine.levels - function(x,y) browser() whatever - function(x,y) combine.levels(x,y) x - 1:5 names(x) - LETTERS[x] y - 6: 10 names(y)

[R] Relationships between png resolution, axis.text$cex trellis setting, and paddings

2011-02-15 Thread Sébastien Bihorel
Dear R-users, I was wondering if somebody could shed some light on the relationships existing between the resolution of a png device, the axis.text$cex trellis setting, and the paddings of the actual graph. In the following code, I create a custom trellis theme that set (among other thing)

[R] Getting variable names in function output

2011-02-02 Thread Sébastien Bihorel
Dear R-users, I would like to have some advises about a problem illustrated by the following snippet. Within myf, I need to evaluate a piece of R code that is passed as a character argument and then return the objects that are created by this code. The difficulty comes from the fact that the

[R] Listing of available functions

2011-01-04 Thread Sébastien Bihorel
Dear R-users, Is there a easy way to access to a complete listing of available functions from a R session? The help.start() and ? functions are great, but I feel like they require the user to know the answer in advance (especially with respect to function names)... I could not find a easy way to

Re: [R] Listing of available functions

2011-01-04 Thread Sébastien Bihorel
as a web page http://www.science.oregonstate.edu/~shenr/Rhelp/00cheat.htmhttp://www.science.oregonstate.edu/%7Eshenr/Rhelp/00cheat.htm Others are available as pdf's. On Jan 4, 2011, at 7:13 AM, Sébastien Bihorel wrote: Dear R-users, Is there a easy way to access to a complete listing

[R] Help with ROracle

2010-12-31 Thread Sébastien Bihorel
Dear R-users, I am working with a colleague on extracting and processing data from our Oracle database using R scripts. We performed some initial testing using functions available in the ROracle package. Overall, our tests were successful and encouraging. There are however a couple of

Re: [R] Manage several graphical devices in interactive mode

2010-07-26 Thread Sébastien Bihorel
...@gmail.comwrote: On 25/07/2010 10:03 AM, (Ted Harding) wrote: On 25-Jul-10 13:22:11, Sébastien Bihorel wrote: Dear R-users, Does anybody know a good way to create and use several graphical devices at the same time in interactive mode? Ideally, I'd like to open 2 to 3 devices and assign names to them

[R] Manage several graphical devices in interactive mode

2010-07-25 Thread Sébastien Bihorel
Dear R-users, Does anybody know a good way to create and use several graphical devices at the same time in interactive mode? Ideally, I'd like to open 2 to 3 devices and assign names to them. This way, I could make any addition/modification/update to a particular device using its name. I did not

[R] R equivalent of SAS proc freq

2010-07-25 Thread Sébastien Bihorel
Dear R-users, I am looking for a R function that would be the equivalent of the SAS proc freq ( http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#/documentation/cdl/en/procstat/63104/HTML/default/procstat_freq_sect006.htm). The table, ftable, xtabs functions are

[R] Problem with vignette printing

2010-05-14 Thread Sébastien Bihorel
Dear R-users, I am trying to figure out why I cannot print vignettes in my new R installation (R.11 on opensuse 11.2). Apparently, vignette objects are properly created but could not be printed: z-vignette('grid') str(z) List of 3 $ file : chr /usr/lib/R/library/grid/doc/grid.Snw $ pdf :

Re: [R] Problem with vignette printing

2010-05-14 Thread Sébastien Bihorel
...@gmail.comwrote: On 14/05/2010 7:25 AM, Sébastien Bihorel wrote: Dear R-users, I am trying to figure out why I cannot print vignettes in my new R installation (R.11 on opensuse 11.2). Apparently, vignette objects are properly created but could not be printed: z-vignette('grid') str(z) List of 3

Re: [R] Problem with vignette printing

2010-05-14 Thread Sébastien Bihorel
Ok, Solved the problem by editing my Renviron file in /usr/lib/R/etc. Thanks everyone for your help. On Fri, May 14, 2010 at 11:48 AM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On Fri, 14 May 2010, Sébastien Bihorel wrote: Yes, I have installed R through opensuse's package installer

Re: [R] Problem with vignette printing

2010-05-14 Thread Sébastien Bihorel
Yes, I have installed R through opensuse's package installer. Is ?Startup the correct place to look at about environment variables or is there a more appropriate help page? On Fri, May 14, 2010 at 10:00 AM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On Fri, 14 May 2010, Sébastien Bihorel

[R] Problem with vignette compilation during R CMD check

2010-05-02 Thread Sébastien Bihorel
Dear R-users, I am going through the last steps of package prep before submission to CRAN and I have the following problem. My package contains a single vignette written in optimbase.Rnw and that in stored in /inst/doc. optimbase.Rnw contains multiple \input{} statements that refer to .tex files

[R] Command not found

2010-04-16 Thread Sébastien Bihorel
Dear R users, I am getting the following error anytime I try to open a vignette, e.g.: vignette('frame',package='grid') sh: : command not found I am working with R version 2.11.0 Under development (unstable) (2010-02-17 r51148) installed on an OpenSuse 11.0 system. Thanks for your help

Re: [R] R package documentation

2010-04-15 Thread Sébastien Bihorel
Thanks David, After a bit of research, I believe that I've found the post you are referring to: http://tolstoy.newcastle.edu.au/R/e9/help/10/03/8779.html I will look into the proposed solutions. Sebastien On Wed, Apr 14, 2010 at 6:01 PM, David Scott d.sc...@auckland.ac.nz wrote: Sébastien

[R] R package documentation

2010-04-14 Thread Sébastien Bihorel
Dear R users, I am currently writing the documentation for my first package. I have created a short user manual using sweave/pdflatex which is distinct from the manual/summary-of-package-functions created by R CMD CHECK. I was wondering how could I seamlessly combine both documents. Thanks for

Re: [R] R package documentation

2010-04-14 Thread Sébastien Bihorel
kind of like this combination. Sebastien On Wed, Apr 14, 2010 at 6:52 AM, Tobias Verbeke tobias.verb...@openanalytics.eu wrote: Hi Sébastien, Sébastien Bihorel wrote: I am currently writing the documentation for my first package. I have created a short user manual using sweave/pdflatex

Re: [R] R package documentation

2010-04-14 Thread Sébastien Bihorel
. the pdfjam toolbox by David Firth. http://go.warwick.ac.uk/pdfjam Best, Tobias On Wed, Apr 14, 2010 at 6:52 AM, Tobias Verbeke tobias.verb...@openanalytics.eu mailto:tobias.verb...@openanalytics.eu wrote: Hi Sébastien, Sébastien Bihorel wrote: I am currently writing

[R] Sweave and kile

2010-03-17 Thread Sébastien Bihorel
Dear R-users, I want to give a try to Sweave and Latex but I am having some problems compiling my .Rnw files within Kile. I have followed the recommendations given in http://tolstoy.newcastle.edu.au/R/e5/help/08/10/4277, but they do not seem to address my particular problem. I am using R 2.11.0

Re: [R] Sweave and kile

2010-03-17 Thread Sébastien Bihorel
variable to include the output suggested by R CMD env |grep TEXINPUTS Martin On 03/17/2010 04:48 PM, Sébastien Bihorel wrote: Dear R-users, I want to give a try to Sweave and Latex but I am having some problems compiling my .Rnw files within Kile. I have followed the recommendations

[R] Question about output from optim

2009-11-30 Thread Sébastien Bihorel
Thanks Ben for your reply, I would very much appreciate if you could share your code. That would be great! Sebastien PS: As suggested, I will forward this email to John Nash. Sébastien Bihorel pomchip at free.fr writes: * ** Dear R-users, ** ** I am trying to port to R something that I wrote

[R] Question about output from optim

2009-11-29 Thread Sébastien Bihorel
Dear R-users, I am trying to port to R something that I wrote in Matlab to perform model parameter optimization using the Nelder-Mead simplex method (fminsearch). I read the help on ?optim (which seems to be the way to go) as well as a bunch of posts on the topic, but I would like to make sure

Re: [R] xyplot and separate abline per plot

2008-06-27 Thread Sébastien Bihorel
Hi Karin, Try this xyplot(numbers~sqrt(breaks)|moltype+disttype, groups = type, data = alldata, panel = function(x, y, ...){ panel.abline(h = 0, col.line = 1) panel.xyplot(x, y, ..., pch = 1, col.symbol = 1)}) Look at panel.abline in the lattice help for more details. Here, h = 0 will plot a