Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Thanks for the suggestion. I believe it is exactly what I need. I will try this function. Thanks! Regards, Shu Fai On Mon, Oct 16, 2023 at 3:39 AM Paul Murrell wrote: > > Hi > > You could also look at dev.capture(), depending on which screen device > you are using. > > Paul > > On 16/10/23

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Thanks a lot for introducing these functions! I am not aware of them but it seems that they can help me to do what I want to do. Regards, Shu Fai Regards, Shu Fai Cheung (張樹輝) On Mon, Oct 16, 2023 at 12:24 AM Duncan Murdoch wrote: > > On 15/10/2023 12:05 p.m., Shu Fai Cheung wrote: > > Let me

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Paul Murrell
Hi You could also look at dev.capture(), depending on which screen device you are using. Paul On 16/10/23 05:24, Duncan Murdoch wrote: On 15/10/2023 12:05 p.m., Shu Fai Cheung wrote: > Let me clarify my question: > > plot.new() > polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5)) > > If

Re: [R] Create new data frame with conditional sums

2023-10-15 Thread Leonard Mada via R-help
Dear Jason, I do not think that the solution based on aggregate offered by GPT was correct. That quasi-solution only aggregates for every individual level. As I understand, you want the cumulative sum. The idea was proposed by Bert; you need only to sort first based on the cutoff (e.g.

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Duncan Murdoch
On 15/10/2023 12:05 p.m., Shu Fai Cheung wrote: Let me clarify my question: plot.new() polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5)) If the device is an on-screen device, can I check whether a particular area has anything drawn on it, or, to be precise, whether the color of a particular area

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Let me clarify my question: plot.new() polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5)) If the device is an on-screen device, can I check whether a particular area has anything drawn on it, or, to be precise, whether the color of a particular area has all pixels equal to the background color.

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Sorry that I did not make my question clear enough. If the device is file based (e.g., a PNG file), then I believe I can do that, by using functions that can inspect an image. This is the solution I originally wanted to try. However, it requires creating a file in the process. I would like to

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Jeff Newmiller via R-help
This question is not clear to me. What is it you hope to retrieve from the device? Note that the type of device in your example is system-dependent. The content in a png() would be different than the content in a win.graph() device. On October 15, 2023 8:04:00 AM PDT, Shu Fai Cheung wrote:

[R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Hi All, I want to inspect the content of a plot generated by another function. For example: plot.new() polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5)) A polygon will be drawn. If I do not know what has been done to generate the plot, is it possible to query the content in the active device?

Re: [R] Create new data frame with conditional sums

2023-10-15 Thread Jason Stout, M.D.
After I sent this, a colleague referred me to the GPT-4 interface on Bing. I entered the exact email query below and it provided the following solution, which worked for the toy example and was successfully adapted to my application: # Define the cutoffs cutoffs <- seq(0, 0.15, by = 0.01) #