Re: [R] How to overlay lines and rectangles in lattice plot key

2016-12-29 Thread sbihorel
ss.com/R-Graphics/Murrell/p/book/9781584884866 Rich On Wed, Dec 28, 2016 at 9:50 PM, sbihorel wrote: Hi, I would like to create a custom key for a lattice xyplot in which line elements are displayed on top of rectangle elements. In the example code below, the lines and rectangles are shown

[R] How to overlay lines and rectangles in lattice plot key

2016-12-28 Thread sbihorel
Hi, I would like to create a custom key for a lattice xyplot in which line elements are displayed on top of rectangle elements. In the example code below, the lines and rectangles are shown side by side (the legend itself is meaningless, but that is not the point). Is there a way to overlay t

Re: [R] How to make a function aware of its own call arguments

2016-03-24 Thread sbihorel
Thanks for the precision. On 3/24/2016 10:40 AM, Duncan Murdoch wrote: On 24/03/2016 10:28 AM, sbihorel wrote: Hi, Thanks for your suggestion. missing(x) works only if x is not altered within the function, which is not the case in my actual function (which is more complex than the example

Re: [R] How to make a function aware of its own call arguments

2016-03-24 Thread sbihorel
Sent from my phone. Please excuse my brevity. On March 24, 2016 5:11:43 AM PDT, sbihorel wrote: Hi, Please consider the following functions: myf1 <- function(x,fun){ if (is.null(fun)){ x } else { do.call(fun, list(x)) } }

[R] How to make a function aware of its own call arguments

2016-03-24 Thread sbihorel
Hi, Please consider the following functions: myf1 <- function(x,fun){ if (is.null(fun)){ x } else { do.call(fun, list(x)) } } myf2 <- function(a=1, b=2, fun=NULL, c=myfun1(b,fun)){ if (myf1(b,fun)>0 & ){ c <- b } print(list(a,b,c)) } myf2(a=2,b=3,fun=exp) myf2(a=2,b=3,

Re: [R] stargazer summary statistics by group

2016-03-06 Thread sbihorel
ou really want is the tables package. -- Sent from my phone. Please excuse my brevity. On March 6, 2016 4:45:58 PM PST, sbihorel > wrote: >Hi Boris, > >Sorry, but not really. The example that comes closest is "Flip the >table >axes" but th

Re: [R] stargazer summary statistics by group

2016-03-06 Thread sbihorel
http://jakeruss.com/cheatsheets/stargazer.html#the-default-summary-statistics-table B. On Mar 6, 2016, at 3:34 PM, sbihorel wrote: Hi, I saw a post on this topic on stackoverflow a while ago. It does not seem to have got any reply... Just trying my luck here. Is there any way to use st

[R] stargazer summary statistics by group

2016-03-06 Thread sbihorel
Hi, I saw a post on this topic on stackoverflow a while ago. It does not seem to have got any reply... Just trying my luck here. Is there any way to use stargazer to create a table of descriptive statistics by group such as the one below? Thanks #-|-Stat--|--A--|--B--|--Overall

[R] Help with step.gam

2016-03-02 Thread sbihorel
Hi, When very simple models are tested in step.gam, I have observed the some difference in the final output result based upon the version of the package tested. Is this an expected behavior or a bug in the latest version of the gam package? With gam 1.4: > data(gam.data) > gam.object <- gam

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread sbihorel
: On Nov 16, 2015, at 9:35 AM, sbihorel wrote: Hi, Thanks everyone for all your insights... I feel that the discussion is getting way deeper and more technical and it needs to be from the point of view of what I was trying to achieve with my little "is.numeric.factor" function (ie

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread sbihorel
Hi, Thanks everyone for all your insights... I feel that the discussion is getting way deeper and more technical and it needs to be from the point of view of what I was trying to achieve with my little "is.numeric.factor" function (ie, checking if an object is a factor and if all levels of th

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread sbihorel
not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Sun, Nov 15, 2015 at 6:22 PM, sbihorel wrote: Hi, Pretty much everything is in the title of the post. An example is below. library(lattice) data <- data.frame(x=rep(1:10,8),y=rno

[R] Why does a custom function called is.numeric.factor break lattice?

2015-11-15 Thread sbihorel
Hi, Pretty much everything is in the title of the post. An example is below. library(lattice) data <- data.frame(x=rep(1:10,8),y=rnorm(80),trt=factor(rep(1:4,each=20)),groups=rep(1:8,each=10)) xyplot <- xyplot(y~x|trt,data,groups=groups) is.numeric.factor <- function(){ print('hello world')

Re: [R] Achieve independent fine user control of ggplot geom settings when using groups in multiple geom's

2015-10-30 Thread sbihorel
t possible. Hadley On Thu, Oct 29, 2015 at 6:31 PM, sbihorel wrote: Thank for your reply, I may accept your point about the mapping consistency when the different geom's use the same data source. However, as pointed out in my example code, this does not have to be the case. Hence my question

Re: [R] Achieve independent fine user control of ggplot geom settings when using groups in multiple geom's

2015-10-29 Thread sbihorel
...1k --- Sent from my phone. Please excuse my brevity. On October 29, 2015 11:27:55 AM MST, sbihorel wrote: Thank you for your reply. I do not have anything specific data/geom/grouping in mind, rather a framework in which users would just pile of

Re: [R] Achieve independent fine user control of ggplot geom settings when using groups in multiple geom's

2015-10-29 Thread sbihorel
ou show us what you're actually trying to accomplish someone can suggest a solution or at least a work-around. Best, Ista On Thu, Oct 29, 2015 at 12:26 PM, sbihorel wrote: Hello, Before I get to my question, I want to make clear that the topic of my present post is similar to posts I recent

[R] Achieve independent fine user control of ggplot geom settings when using groups in multiple geom's

2015-10-29 Thread sbihorel
Hello, Before I get to my question, I want to make clear that the topic of my present post is similar to posts I recently submitted to the list. Although I appreciate the replies I got, I believe that I did not correctly frame these previous posts to get to the bottom of things. I also want to

Re: [R] ggplot: combining geom's in function

2015-10-23 Thread sbihorel
oftware/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On October 23, 2015 3:12:41 PM GMT+02:00, sbihorel wrote: Hi, Next adventure into my journey from lattice to ggplot: I would like to create a custom generic function that

Re: [R] ggplot: combining geom's in function

2015-10-23 Thread sbihorel
O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On October 23, 2015 3:12:41 PM GMT+02:00, sbihorel wrote: Hi, Next adventu

Re: [R] Control of x-axis variable ordering in ggplot

2015-10-23 Thread sbihorel
s = 4), g = rep(1:4, each = 25) ) data$x <- data$x + 0.005 * data$y ^ 2 - 0.1 * data$y + 1 ggplot(data, aes(x, y, colour = factor(g))) + geom_point() + geom_path() Alsonotethatcodeismucheasiertoreadifyouusespaces;) Hadley On Thu, Oct 22, 2015 at 8:46 PM, sbihorel wrote: Hi, Given

[R] ggplot: combining geom's in function

2015-10-23 Thread sbihorel
Hi, Next adventure into my journey from lattice to ggplot: I would like to create a custom generic function that combines multiple existing geom's in order to reproduce what the lattice panel.xyplot function does based on the type argument (ie, plotting points only for type='p', plotting lin

[R] Control of x-axis variable ordering in ggplot

2015-10-22 Thread sbihorel
Hi, Given a certain data.frame, the lattice xyplot function will plot the data as.is and join the data point in the order of the data frame. It is my (probably flawed) understanding that, using the same data frame, ggplot orders the data by increasing order of the x-axis variable. Can one con

Re: [R] ggplot2: discontinuous ribbon

2015-10-21 Thread sbihorel
~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-10-21 11:20 GMT+02:00 sbihorel <mailto:sebastien.biho...@cognigencorp.com>>: Hi I would like

[R] ggplot2: discontinuous ribbon

2015-10-21 Thread sbihorel
Hi I would like to use ggplot2 to create a 2d plot showing a series of shaded areas that are not continuous with respect to the x-axis variable. The expected result is illustrated below using lattice/grid functions. - pdata <- data.frame( x=c(1,2,2,1,NA,3,4,4,3,NA,5,6,6,5), y

Re: [R] Using latticeExtra as.layer function with different number of plot panels

2015-07-31 Thread sbihorel
Thanks David, I was hoping for something a little bit more generic and less case-by-case basis. Sebastien On 7/30/2015 3:51 PM, David Winsemius wrote: On Jul 30, 2015, at 8:37 AM, sbihorel wrote: Hi, When the as.layer function is used to overaly 2 lattice plots, there seems to be an

[R] Using latticeExtra as.layer function with different number of plot panels

2015-07-30 Thread sbihorel
Hi, When the as.layer function is used to overaly 2 lattice plots, there seems to be an assumption that the data used in both plots will generate the same number of panels (and, I believe, in the same order). In case the data used in the plot within the as.layer call is incomplete , data may

Re: [R] Equivalent of read.table for object rather than file

2014-08-06 Thread sbihorel
mailing list and must admit that I did not read it since. Never had any issues in the past sending post in plain text or HTML format. That being said, I will be careful about this in the future. Thank you for your help. Sebastien On 05/08/2014 19:15, sbihorel wrote: / Hi, />/ />/ Thanks f

Re: [R] Equivalent of read.table for object rather than file

2014-08-05 Thread sbihorel
Hi, Thanks for the info. Unfortunately, read.table() does not have the text argument in the version of R that I can use. Do you know when was this argument introduced? Sebastien On 05/08/2014 18:29, sbihorel wrote: >/ Hi, />/ />/ Let's say that I have a scalar character obj

[R] Equivalent of read.table for object rather than file

2014-08-05 Thread sbihorel
Hi, Let's say that I have a scalar character object called tmp which stores the entire content of an ASCII file. Is there a function that would process tmp the same way read.table() would process the content of the original ASCII file? The content of tmp will come from a database, and I want t