[Rd] image (PR#11493)
Full_Name: Joseph Scandura Version: 2.7.0 OS: Mac 10.5 Submission from: (NULL) (140.251.50.94) Since updating to 2.7.0 all plots that use image() (heatmap, etc...) now draw visible boxes around each rectangle in the plot. When there are many rectangles the surrounding color becomes dominant over the rectangle color and the overall image is borderline useless. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] need some help in plotting xy graph
1) If you need some help, *PLEASE* use the R-help mailing list. 2) Sending your e-mail more than once (you sent it 3 times!) to the same mailing list of hundreds of subscribers is considered very impolite. Martin Maechler, ETH Zurich, R-devel List manager > "KR\" == Kurapati, Ravichandra \(Ravichandra\) <[EMAIL PROTECTED]> > on Wed, 21 May 2008 10:24:48 +0530 writes: KR\> Hi KR\> Dataframefdf contains KR\> bin rate overlay KR\> 1 1 90 Assign First/cc _from_SN_53 RNC_20_to_SN_50 RNC_21_Success KR\> Rate KR\> 2 2 93 Assign First/cc _from_SN_53 RNC_20_to_SN_50 RNC_21_Success KR\> Rate KR\> 3 1 90 Assign First/cc _from_SN_50 RNC_21_to_SN_53 RNC_20_Success KR\> Rate KR\> 4 2 94 Assign First/cc _from_SN_50 RNC_21_to_SN_53 RNC_20_Success KR\> Rate KR\> time KR\> 1 (04/01/08 16:02:30) KR\> 2 (04/01/08 16:07:30) KR\> 3 (04/01/08 16:02:30) KR\> 4 (04/01/08 16:07:30) KR\> And then I write the following lines of code to plot a xygraph on a pdf KR\> file KR\> n <- length(unique(fdf$time)) KR\> x <-sort(unique(fdf$time)) KR\> y<-UTCsecs2chron(x) KR\> xscales <- computeTimeScales(y) KR\> yscales<-NULL KR\> scales<-c(xscales,yscales) KR\> ylab<-"session transfer rate" KR\> xlab<-"time" KR\> lgnd.txt<-levels(fdf$overlay) KR\> celnet.trellis.device(device="pdf", file="ravi_st.pdf", width=10,height KR\> = 10) KR\> main<-"this is the first report" KR\> formd="rate ~ as.numeric(time)" KR\> print( KR\> xyplot(formula(formd), KR\> data = fdf, groups = overlay, KR\> type = "b", as.table = TRUE, cex=0.20, KR\> #subset = ok, commented to show breaks in graph KR\> main = main, xlab = "Time", ylab = ylab, KR\> scales = scales, KR\> key = simpleKey(text = lgnd.txt, cex = 3/4, KR\> points = FALSE, lines = TRUE), KR\> page = function(n) annotate(opts$ann), KR\> sub = "", KR\> layout = c(1,1) KR\> ) KR\> ) KR\> "computeTimeScales" <- KR\> function(z, rot=0) ## z is a chron object KR\> {browser() KR\> ## how many days do the data span? KR\> n.days <- ceiling(diff(range(z, na.rm = TRUE))) KR\> ## compute x ticks, pretty labels KR\> x <- as.numeric(z) KR\> r <- range(x, na.rm = TRUE) KR\> at.x <- seq(from = r[1], to = r[2], length = 7) KR\> two_digits <- function(x){ KR\> x <- paste("0", x, sep="") KR\> substring(x,nchar(x)-1) KR\> } KR\> ## heuristics: use hh:mm when range of data falls within one day, KR\> ## otherwise use MM-DD hh:mm. KR\> at.z <- chron(at.x) KR\> hh <- paste(two_digits(hours(at.z)), two_digits(minutes(at.z)), KR\> sep=":") KR\> if(0){## hh:ss # this is commented as for more than one day KR\> from/to time no date was printed KR\> at.lbls <- hh KR\> } KR\> else { ## MM-DD\nhh:ss KR\> m <- month.day.year(at.z) KR\> dd <- paste(two_digits(m$month), two_digits(m$day), sep="-") KR\> at.lbls <- paste(dd, hh, sep="\n") KR\> } KR\> list(x=list(at = at.x, rot=rot, labels = at.lbls)) KR\> } KR\> "celnet.theme" <- KR\> function() KR\> { KR\> celnet.theme <- canonical.theme("pdf", color = TRUE) KR\> if(tolower(.Device) =="png") KR\> celnet.theme$background$col <- "white" KR\> else KR\> canonical.theme("pdf", color = TRUE) KR\> celnet.theme$background$col <- "transparent" KR\> celnet.theme KR\> } KR\> "celnet.trellis.device" <- KR\> function(device, file, width = NULL, height = NULL,...) KR\> { KR\> ## analogous to trellis.device() -- this is just tailored to Celnet KR\> if(is.null(width)) KR\> width <- 8 KR\> if(is.null(height)) KR\> height <- 6 KR\> if(tolower(device)=="png"){ KR\> if(missing(width)) width <- 72 * width KR\> if(missing(height)) height <- 72 * height KR\> } KR\> if(tolower(device)=="x11") KR\> trellis.device(device, width=width, height=height, KR\> theme=celnet.theme()) KR\> if(tolower(device)=="ps" || tolower(device)=="postscript") KR\> trellis.device("postscript", file=file, color = TRUE, KR\> width=width, height=height, theme=celnet.theme()) KR\> else KR\> trellis.device(device, file=file, KR\> width=width, height=height, theme=celnet.theme()) KR\> } KR\> "annotate" <- KR\> function(str, ...) KR\> ## print a metadata message at the top-bottom of current trellis KR\> display KR\> { else if(n==1){ KR\> x <- 0.95 KR\> hjust <- "right" KR\> } else if(n==2){ KR\> x <- c(0.05, 0.95) KR\> hjust <- c("left", "right") KR\> } else if(n==3){ KR\> x <-
Re: [Rd] interrupting native code
I have a structure from a library that I am using an external pointer to keep track of. The methods in this library (lp_solve) have the facility to call a function periodically and I would like to use R_ProcessEvents. The problem is that if an interrupt is requested then R returns to the command prompt without completing the library method. This leaves the structure in a messed-up state so that I can't even successfully delete it, potentially leaking a lot of memory. So what I am trying to do is find a way to see if an event has occurred (in this case an interrupt) so I can respond to it before onintr() gets called. Kjell On 20 mai 08, at 19:22, Simon Urbanek wrote: On May 20, 2008, at 10:58 AM, Kjell Konis wrote: I would actually prefer a mechanism that simply returns a flag indicating that an interrupt has been requested. Then I would be able to clean up and return on my own - no longjmp required. Also, it would be useful if there was a function similar to R_ProcessEvents that only dealt with keeping the GUI responsive. I don't understand what you mean by the last sentence - that is exactly what R_ProcessEvents is for - or am I missing something? Cheers, Simon Cheers, Kjell On 16 mai 08, at 13:54, Luke Tierney wrote: I'm not sure you can make this work as some of the things needed either are or should be private to the core implementation and not available to package code. In any case I would not recommend this approach for two reasons. First, details of what happens in interrupt checking are subject to change and your code would miss those changes unless you track them carefully. More importantly, several things here could generate an error that results in a longjmp and leaves your code in an unstable state. What is needed for this is a mechanism for detecting an interrupt but not doing the longjmp, just returning a flag that a longjmp is needed and enough information to allow it to be made after cleanup code has been run. This has been on my to do list for a while but getting the semantics right is tricky and so it hasn't happened yet. Hopefully it will be in 2.8.0. In the interim you can cobble something together using R_ToplevelExec, interpreting all FALSE return values as user interrupts. Another option, also under consideration but not available yet, is a C mechanism for registering cleanup operations if a longjmp occurs. A quick and dirty version of that could be provided fairly easily but a better version, which would be preferable in the long run, requires a rewrite of the code that implements jumps and cleanup/on.exit actions. This may take a bit longer to implement. Best, luke On Fri, 16 May 2008, Kjell Konis wrote: You mean something like this (I return 1 instead of calling onintr())? Will HAVE_AQUA and Win32 be appropriately defined when building my package (I can't see how to check with R CMD config)? int My_CheckUserInterrupt(void) { R_CheckStack(); #if ( defined(HAVE_AQUA) ) /* R_ProcessEvents() from unix/aqua.c*/ if (ptr_R_ProcessEvents) ptr_R_ProcessEvents(); if (R_interrupts_pending) return(1); #elseif ( defined(Win32) ) /* R_ProcessEvents() from gnuwin32/system.c */ while (peekevent()) doevent(); if (UserBreak) { UserBreak = FALSE; return(1); } R_CallBackHook(); if(R_tcldo) R_tcldo(); #else R_PolledEvents(); if (R_interrupts_pending) return(1); #endif return(0); } On 16 mai 08, at 12:43, Prof Brian Ripley wrote: On Fri, 16 May 2008, Kjell Konis wrote: The problem is that my package uses an external pointer to keep track of a structure created by the lp_solve library. If I use R_CheckUserInterrupt in the lp_solve abort function it leaves the structure in a messed-up state after an interrupt occurs. I am not even able to free the memory allocated in the structure. I need to be able to tell the lp_solve functions to interrupt themselves if I am going to support interrupts at all. I took a longer look at errors.c and it seems my solution should work as long as neither HAVE_AQUA nor Win32 are defined. Under the circumstances, I think that's the best I can do. Any suggestions for a UI independent way to check for interrupts would be appreciated. Why not use the same code as R_CheckUserInterrupt but instead of calling onintr, call your own interrupt routine? Thanks, Kjell On 15 mai 08, at 16:41, Prof Brian Ripley wrote: How is R_interrupts_pending going to be set? It is set in the interrupt handler for SIGINT, but that is not the only way to indicate an interrupt, and it is not necessarily available to users of GUIs and embedded R. Without servicing the GUIs all interaction will be dead, including sending an interrrupt from menus/buttons/keyboard. See the comment in the code for R_CheckUserInterrupt. On Thu, 15 May 2008, Kjell Konis wrote: Hello, I have some native code that I would like to allow users to interrupt. However
[Rd] \S4method in combination with "[" and "[<-"
Dear developers, We want to use "\S4method" to document new S4-methods for "[" and "[<-". We use this for other functions/methods and it works without any problem, but in case of "[" and "[<-" we didn't manage to bring this to work. The problem occurs in the development version of our package "distrSim" which can be found under http://r-forge.r-project.org/R/?group_id=87. The warning we obtain is Bad \usage lines found in documentation object 'Subsetting-methods': \S4method{[}{SeqDataFrames}(x, i, j, k, drop = FALSE) \S4method{[<-}{SeqDataFrames}(x, i, j, k, value) Of course, we tried several different possibilities but with no success. Does someone know a package which shows a use case for this situation? I looked in several packages but could not found any. Thanks for your help! Matthias -- Dr. Matthias Kohl www.stamats.de __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] \S4method in combination with "[" and "[<-"
Hello Matthias I too struggled with this for a long long time. I'm not sure if this answers your question, but Brobdingnag_1.1-2.tar.gz is clean under R-2.7.0, and this package includes S4 methods for extract/replace. Extract.Rd in the package doesn't use \S4method; also, I couldn't figure out how to include a "usage" section without R CMD check throwing a wobbly. Extract.Rd is not ideal, but seems to work in practice: the user types ?"[.brob" and gets some support, but it would have been better to have an explicit usage section too. best wishes rksh On 21 May 2008, at 09:23, Matthias Kohl wrote: Dear developers, We want to use "\S4method" to document new S4-methods for "[" and "[<-". We use this for other functions/methods and it works without any problem, but in case of "[" and "[<-" we didn't manage to bring this to work. The problem occurs in the development version of our package "distrSim" which can be found under http://r-forge.r-project.org/R/?group_id=87 . The warning we obtain is Bad \usage lines found in documentation object 'Subsetting-methods': \S4method{[}{SeqDataFrames}(x, i, j, k, drop = FALSE) \S4method{[<-}{SeqDataFrames}(x, i, j, k, value) Of course, we tried several different possibilities but with no success. Does someone know a package which shows a use case for this situation? I looked in several packages but could not found any. Thanks for your help! Matthias -- Dr. Matthias Kohl www.stamats.de __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Robin Hankin Uncertainty Analyst and Neutral Theorist, National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] \S4method in combination with "[" and "[<-"
Hello Robin, thanks for your solution! Other solutions I know: 1. In the Matrix package - version 0.999375-9. See Subassign-methods.Rd and Xtrct-methods.Rd. 2. The other possibility, which we use in some situations and which for instance is used in package Biobase (e.g., S4-class eSet), is to document methods in the Rd-files of the corresponding S4-classes. However, both solutions are without using "\S4method". Best, Matthias Robin Hankin wrote: Hello Matthias I too struggled with this for a long long time. I'm not sure if this answers your question, but Brobdingnag_1.1-2.tar.gz is clean under R-2.7.0, and this package includes S4 methods for extract/replace. Extract.Rd in the package doesn't use \S4method; also, I couldn't figure out how to include a "usage" section without R CMD check throwing a wobbly. Extract.Rd is not ideal, but seems to work in practice: the user types ?"[.brob" and gets some support, but it would have been better to have an explicit usage section too. best wishes rksh On 21 May 2008, at 09:23, Matthias Kohl wrote: Dear developers, We want to use "\S4method" to document new S4-methods for "[" and "[<-". We use this for other functions/methods and it works without any problem, but in case of "[" and "[<-" we didn't manage to bring this to work. The problem occurs in the development version of our package "distrSim" which can be found under http://r-forge.r-project.org/R/?group_id=87. The warning we obtain is Bad \usage lines found in documentation object 'Subsetting-methods': \S4method{[}{SeqDataFrames}(x, i, j, k, drop = FALSE) \S4method{[<-}{SeqDataFrames}(x, i, j, k, value) Of course, we tried several different possibilities but with no success. Does someone know a package which shows a use case for this situation? I looked in several packages but could not found any. Thanks for your help! Matthias -- Dr. Matthias Kohl www.stamats.de __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Robin Hankin Uncertainty Analyst and Neutral Theorist, National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 -- Dr. Matthias Kohl www.stamats.de __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] \S4method in combination with "[" and "[<-"
For the $ operator defined as S4 method, \S4method does not work as well. However, the following clauses let it through the check w/o warnings or errors: \alias{$,character-method} \alias{$<-,character,ANY-method} \usage{ ## S4 methods for signature 'MyClass,character' x$name x$name <- value } So, why not to try the following? \usage{ ## S4 methods for ... [(x, i, j, ..., drop=TRUE) [(x, i, j, ...) <- value } Dr Oleg Sklyar Technology Group Man Investments Ltd +44 (0)20 7144 3803 [EMAIL PROTECTED] > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Robin Hankin > Sent: 21 May 2008 09:41 > To: Matthias Kohl > Cc: r-devel@r-project.org; Dr. Peter Ruckdeschel > Subject: Re: [Rd] \S4method in combination with "[" and "[<-" > > Hello Matthias > > I too struggled with this for a long long time. > > I'm not sure if this answers your question, but > Brobdingnag_1.1-2.tar.gz is clean under R-2.7.0, and this > package includes S4 methods for extract/replace. > > Extract.Rd in the package doesn't use \S4method; also, I > couldn't figure out how to include a "usage" section without > R CMD check throwing a wobbly. > > Extract.Rd is not ideal, but > seems to work in practice: the user types ?"[.brob" > and gets some support, but it would have been better to have > an explicit usage section too. > > > best wishes > > > rksh > > > > > > On 21 May 2008, at 09:23, Matthias Kohl wrote: > > > Dear developers, > > > > We want to use "\S4method" to document new S4-methods for "[" and > > "[<-". We use this for other functions/methods and it works without > > any problem, but in case of "[" and "[<-" we didn't manage to bring > > this to work. > > > > The problem occurs in the development version of our package > > "distrSim" which can be found under > > http://r-forge.r-project.org/R/?group_id=87 > > . > > > > The warning we obtain is > > > > Bad \usage lines found in documentation object 'Subsetting-methods': > > \S4method{[}{SeqDataFrames}(x, i, j, k, drop = FALSE) > > \S4method{[<-}{SeqDataFrames}(x, i, j, k, value) > > > > Of course, we tried several different possibilities but with no > > success. > > > > Does someone know a package which shows a use case for this > situation? > > I looked in several packages but could not found any. > > > > Thanks for your help! > > Matthias > > > > -- > > Dr. Matthias Kohl > > www.stamats.de > > > > __ > > R-devel@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-devel > > -- > Robin Hankin > Uncertainty Analyst and Neutral Theorist, National > Oceanography Centre, Southampton European Way, Southampton > SO14 3ZH, UK > tel 023-8059-7743 > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > ** The contents of this email are for the named addressee(s...{{dropped:22}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] \S4method in combination with "[" and "[<-"
> Matthias Kohl writes: > Dear developers, > We want to use "\S4method" to document new S4-methods for "[" and "[<-". > We use this for other functions/methods and it works without any > problem, but in case of "[" and "[<-" we didn't manage to bring this to > work. > The problem occurs in the development version of our package "distrSim" > which can be found under http://r-forge.r-project.org/R/?group_id=87. > The warning we obtain is > Bad \usage lines found in documentation object 'Subsetting-methods': > \S4method{[}{SeqDataFrames}(x, i, j, k, drop = FALSE) > \S4method{[<-}{SeqDataFrames}(x, i, j, k, value) > Of course, we tried several different possibilities but with no > success. You should be able to do the same you would do for indicating S3 methods for subsetting. I.e., \S4method{[}{SeqDataFrames}(x, i, j, k) <- value If this does not work, it is a bug. I'll have a look. -k > Does someone know a package which shows a use case for this situation? I > looked in several packages but could not found any. > Thanks for your help! > Matthias > -- > Dr. Matthias Kohl > www.stamats.de > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] \S4method in combination with "[" and "[<-"
Dear Kurt, I tried your proposal. It also led to Bad \usage lines found in documentation object 'Subsetting-methods': \S4method{[}{SeqDataFrames}(x, i, j, k, drop = FALSE) \S4method{[}{SeqDataFrames}(x, i, j, k) <- value My sessionInfo: R version 2.7.0 Patched (2008-05-20 r45741) i686-pc-linux-gnu locale: LC_CTYPE=de_DE.UTF-8;LC_NUMERIC=C;LC_TIME=de_DE.UTF-8;LC_COLLATE=de_DE.UTF-8;LC_MONETARY=C;LC_MESSAGES=de_DE.UTF-8;LC_PAPER=de_DE.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=de_DE.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base Best, Matthias Kurt Hornik wrote: Matthias Kohl writes: Dear developers, We want to use "\S4method" to document new S4-methods for "[" and "[<-". We use this for other functions/methods and it works without any problem, but in case of "[" and "[<-" we didn't manage to bring this to work. The problem occurs in the development version of our package "distrSim" which can be found under http://r-forge.r-project.org/R/?group_id=87. The warning we obtain is Bad \usage lines found in documentation object 'Subsetting-methods': \S4method{[}{SeqDataFrames}(x, i, j, k, drop = FALSE) \S4method{[<-}{SeqDataFrames}(x, i, j, k, value) Of course, we tried several different possibilities but with no success. You should be able to do the same you would do for indicating S3 methods for subsetting. I.e., \S4method{[}{SeqDataFrames}(x, i, j, k) <- value If this does not work, it is a bug. I'll have a look. -k Does someone know a package which shows a use case for this situation? I looked in several packages but could not found any. Thanks for your help! Matthias -- Dr. Matthias Kohl www.stamats.de __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Dr. Matthias Kohl www.stamats.de __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] image (PR#11493)
On Tue, May 20, 2008 at 5:05 PM, <[EMAIL PROTECTED]> wrote: > Full_Name: Joseph Scandura > Version: 2.7.0 > OS: Mac 10.5 > Submission from: (NULL) (140.251.50.94) > > > Since updating to 2.7.0 all plots that use image() (heatmap, etc...) now draw > visible boxes around each rectangle in the plot. When there are many > rectangles > the surrounding color becomes dominant over the rectangle color and the > overall > image is borderline useless. ...and so are bug reports without reproducible examples. More seriously, for the hardworking R core people [I'm not one] spending their time going through bug reports (and people on R-devel list), please imagine yourself in their position and you realize quickly that you can help them out with by giving a reproducible example that they can cut'n'paste into their R session. Also, reporting the output of sessionInfo() is considered good etiquette. In your case you might even be able to submit "before and after" PNGs/PDFs illustrating the difference. Cheers Henrik > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] image (PR#11493)
On May 20, 2008, at 8:05 PM, [EMAIL PROTECTED] wrote: Full_Name: Joseph Scandura Version: 2.7.0 OS: Mac 10.5 Submission from: (NULL) (140.251.50.94) Since updating to 2.7.0 all plots that use image() (heatmap, etc...) now draw visible boxes around each rectangle in the plot. When there are many rectangles the surrounding color becomes dominant over the rectangle color and the overall image is borderline useless. Can you, please, specify exactly which graphics device you are using and possibly a snapshot of the problem? I don't see any additional boxes being drawn on any device. The only issue I'm aware of are anti-aliasing effects around the edges of adjacent rectangles which don't fall on the pixel boundary (if anti- aliasing device is used). Depending on the subpixel location of the edge, the background color may shine through very slightly. It's not what you describe, but it's closest to what I can imagine you could mean. However, AFAICS this has not been changed recently and is a rendering artifact which is hard to get rid of in the current setup as devices are resolution-independent (the only cure I'm aware of [short of disabling anti-aliasing] is to distort the original plot such that rectangles are aligned with the pixels of the output medium). Cheers, Simon __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] interrupting native code
If you are using an external pointer you can register a finalizer that does the cleanup at gc time in case of an abnormal exit. Otherwise you should for now be able to use R_ToplevelExec tigether with R_CheckUserInterrupt as I suggested previously. Best, luke On Wed, 21 May 2008, Kjell Konis wrote: I have a structure from a library that I am using an external pointer to keep track of. The methods in this library (lp_solve) have the facility to call a function periodically and I would like to use R_ProcessEvents. The problem is that if an interrupt is requested then R returns to the command prompt without completing the library method. This leaves the structure in a messed-up state so that I can't even successfully delete it, potentially leaking a lot of memory. So what I am trying to do is find a way to see if an event has occurred (in this case an interrupt) so I can respond to it before onintr() gets called. Kjell On 20 mai 08, at 19:22, Simon Urbanek wrote: On May 20, 2008, at 10:58 AM, Kjell Konis wrote: I would actually prefer a mechanism that simply returns a flag indicating that an interrupt has been requested. Then I would be able to clean up and return on my own - no longjmp required. Also, it would be useful if there was a function similar to R_ProcessEvents that only dealt with keeping the GUI responsive. I don't understand what you mean by the last sentence - that is exactly what R_ProcessEvents is for - or am I missing something? Cheers, Simon Cheers, Kjell On 16 mai 08, at 13:54, Luke Tierney wrote: I'm not sure you can make this work as some of the things needed either are or should be private to the core implementation and not available to package code. In any case I would not recommend this approach for two reasons. First, details of what happens in interrupt checking are subject to change and your code would miss those changes unless you track them carefully. More importantly, several things here could generate an error that results in a longjmp and leaves your code in an unstable state. What is needed for this is a mechanism for detecting an interrupt but not doing the longjmp, just returning a flag that a longjmp is needed and enough information to allow it to be made after cleanup code has been run. This has been on my to do list for a while but getting the semantics right is tricky and so it hasn't happened yet. Hopefully it will be in 2.8.0. In the interim you can cobble something together using R_ToplevelExec, interpreting all FALSE return values as user interrupts. Another option, also under consideration but not available yet, is a C mechanism for registering cleanup operations if a longjmp occurs. A quick and dirty version of that could be provided fairly easily but a better version, which would be preferable in the long run, requires a rewrite of the code that implements jumps and cleanup/on.exit actions. This may take a bit longer to implement. Best, luke On Fri, 16 May 2008, Kjell Konis wrote: You mean something like this (I return 1 instead of calling onintr())? Will HAVE_AQUA and Win32 be appropriately defined when building my package (I can't see how to check with R CMD config)? int My_CheckUserInterrupt(void) { R_CheckStack(); #if ( defined(HAVE_AQUA) ) /* R_ProcessEvents() from unix/aqua.c*/ if (ptr_R_ProcessEvents) ptr_R_ProcessEvents(); if (R_interrupts_pending) return(1); #elseif ( defined(Win32) ) /* R_ProcessEvents() from gnuwin32/system.c */ while (peekevent()) doevent(); if (UserBreak) { UserBreak = FALSE; return(1); } R_CallBackHook(); if(R_tcldo) R_tcldo(); #else R_PolledEvents(); if (R_interrupts_pending) return(1); #endif return(0); } On 16 mai 08, at 12:43, Prof Brian Ripley wrote: On Fri, 16 May 2008, Kjell Konis wrote: The problem is that my package uses an external pointer to keep track of a structure created by the lp_solve library. If I use R_CheckUserInterrupt in the lp_solve abort function it leaves the structure in a messed-up state after an interrupt occurs. I am not even able to free the memory allocated in the structure. I need to be able to tell the lp_solve functions to interrupt themselves if I am going to support interrupts at all. I took a longer look at errors.c and it seems my solution should work as long as neither HAVE_AQUA nor Win32 are defined. Under the circumstances, I think that's the best I can do. Any suggestions for a UI independent way to check for interrupts would be appreciated. Why not use the same code as R_CheckUserInterrupt but instead of calling onintr, call your own interrupt routine? Thanks, Kjell On 15 mai 08, at 16:41, Prof Brian Ripley wrote: How is R_interrupts_pending going to be set? It is set in the interrupt handler for SIGINT, but that is not the only way to indicate an interrupt, and it is not necessarily available to users of GUIs and embedded R. Without servicing the GUIs all interaction will be dead
[Rd] Problem with R or fBasics Package (PR#11495)
I have a problem wirh R: After loding fBasics packages log funtion doesn't work like as fallow: Cenap ERDEMIR Hacettepe University Turkey > log(20) [1] 2.995732 > local({pkg <- select.list(sort(.packages(all.available = TRUE))) + if(nchar(pkg)) library(pkg, character.only=TRUE)}) Loading required package: fImport Loading required package: fSeries Loading required package: robustbase Loading required package: fCalendar Loading required package: fEcofin Loading required package: fUtilities Loading required package: MASS Rmetrics Package fUtilities (270.73) loaded. Rmetrics Package fEcofin (270.73) loaded. Rmetrics, (C) 1999-2006, Diethelm Wuertz, GPL fCalendar: Time, Date and Calendar Tools Package fSeries (260.72) loaded. Rmetrics - Financial Time Series Objects Rmetrics, (C) 1999-2007, Diethelm Wuertz, GPL Attaching package: 'fImport' The following object(s) are masked from package:fCalendar : economagicImport, forecastsImport, fredImport, keystatsImport, yahooImport, yahooSeries Package fBasics (260.72) loaded. Rmetrics - Markets and Basic Statistics Rmetrics, (C) 1999-2007, Diethelm Wuertz, GPL > log(20) Error in .Internal(log(x)) : no internal function "log" __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] table(factor(x), exclude=NULL) (PR#11494)
Hi. I don't know if this a bug or just annoying to me: > x <- c(1,2,3,NA) > table(x, exclude=NULL) x 123 1111 > table(factor(x), exclude=NULL) 1 2 3 1 1 1 I don't think many people use factor(x, exclude=NULL): it is not the default handling of character data by read.table(). Cheers, David Duffy. -- | David Duffy (MBBS PhD) ,-_|\ | email: [EMAIL PROTECTED] ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Problem with R or fBasics Package (PR#11495)
"CET" == [EMAIL PROTECTED] on Wed, 21 May 2008 10:20:09 +0200 (CEST) CET> I have a problem wirh R: After loding fBasics packages log CET> funtion doesn't CET> work like as fallow: CET> Cenap ERDEMIR CET> Hacettepe University CET> Turkey Thanks for your report, I will take care of it. Please do not post issues related to Rmetrics as a bug to the Rd or R-bug list, but rather to the Rmetrics developers mailing-list [EMAIL PROTECTED] regards, Yohan -- PhD student Swiss Federal Institute of Technology Zurich www.ethz.ch www.rmetrics.org NOTE: Rmetrics Workshop: http://www.rmetrics.org/meielisalp.htm June 29th - July 3rd Meielisalp, Lake Thune, Switzerland __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Problem with R or fBasics Package (PR#11495)
This indicates that you need to reinstall your packages for the current version of R (and you have not even told us what that is, nor your OS). It is not a bug in R, and something frequently answered on the R-help mailing list. On Wed, 21 May 2008, [EMAIL PROTECTED] wrote: > I have a problem wirh R: After loding fBasics packages log funtion doesn't > work like as fallow: > Cenap ERDEMIR > Hacettepe University > Turkey >> log(20) > [1] 2.995732 >> local({pkg <- select.list(sort(.packages(all.available = TRUE))) > + if(nchar(pkg)) library(pkg, character.only=TRUE)}) > Loading required package: fImport > Loading required package: fSeries > Loading required package: robustbase > Loading required package: fCalendar > Loading required package: fEcofin > Loading required package: fUtilities > Loading required package: MASS > Rmetrics Package fUtilities (270.73) loaded. > Rmetrics Package fEcofin (270.73) loaded. > > Rmetrics, (C) 1999-2006, Diethelm Wuertz, GPL > fCalendar: Time, Date and Calendar Tools > > Package fSeries (260.72) loaded. > Rmetrics - Financial Time Series Objects > Rmetrics, (C) 1999-2007, Diethelm Wuertz, GPL > > > Attaching package: 'fImport' > > >The following object(s) are masked from package:fCalendar : > > economagicImport, > forecastsImport, > fredImport, > keystatsImport, > yahooImport, > yahooSeries > > > Package fBasics (260.72) loaded. > Rmetrics - Markets and Basic Statistics > Rmetrics, (C) 1999-2007, Diethelm Wuertz, GPL > >> log(20) > Error in .Internal(log(x)) : no internal function "log" > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] doc buglet / system method
Under Value section for system: If the command could not be run for any reason, the value is 256*127 = 52512. ^ should be 32512 R version 2.7.0 Patched (2008-05-20 r45743) -- SIGSIG -- signature too long (core dumped) __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Problem with R or fBasics Package (PR#11495)
It's not a problem with R, it's just fBasics is buggy! It overrides log and round. Please contact the maintainer of the fBasics package. Dr Oleg Sklyar Technology Group Man Investments Ltd +44 (0)20 7144 3803 [EMAIL PROTECTED] > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: 21 May 2008 09:20 > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: [Rd] Problem with R or fBasics Package (PR#11495) > > > I have a problem wirh R: After loding fBasics packages log > funtion doesn't work like as fallow: > Cenap ERDEMIR > Hacettepe University > Turkey > > log(20) > [1] 2.995732 > > local({pkg <- select.list(sort(.packages(all.available = TRUE))) > + if(nchar(pkg)) library(pkg, character.only=TRUE)}) > Loading required package: fImport > Loading required package: fSeries > Loading required package: robustbase > Loading required package: fCalendar > Loading required package: fEcofin > Loading required package: fUtilities > Loading required package: MASS > Rmetrics Package fUtilities (270.73) loaded. > Rmetrics Package fEcofin (270.73) loaded. > > Rmetrics, (C) 1999-2006, Diethelm Wuertz, GPL > fCalendar: Time, Date and Calendar Tools > > Package fSeries (260.72) loaded. > Rmetrics - Financial Time Series Objects Rmetrics, (C) > 1999-2007, Diethelm Wuertz, GPL > > > Attaching package: 'fImport' > > > The following object(s) are masked from package:fCalendar : > > economagicImport, > forecastsImport, > fredImport, > keystatsImport, > yahooImport, > yahooSeries > > > Package fBasics (260.72) loaded. > Rmetrics - Markets and Basic Statistics > Rmetrics, (C) 1999-2007, Diethelm Wuertz, GPL > > > log(20) > Error in .Internal(log(x)) : no internal function "log" > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > ** The contents of this email are for the named addressee(s...{{dropped:22}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] rawToChar(raw(0))
Hi, right now we have (on R v2.7.0 patched (2008-04-23 r45466)) that: > rawToChar(raw(0)) [1] "" > rawToChar(raw(0), multiple=TRUE) character(0) Is this intended or should both return character(0)? Personally, I would prefer that an empty input vector returns an empty output vector. Same should then apply to charToRaw(), but right now we get: > x <- character(0) > charToRaw(x) Error in charToRaw(x) : argument must be a character vector of length 1 I am aware of the new rules for R v2.8.0dev on truncating nuls in character strings. That would make charToRaw(x) return the same regardless of x==character(0) or x=="" ("\0"). We have with R v2.8.0dev: > x <- "" > charToRaw(x) raw(0) Is guess this is on purpose because "" == "" and "a" == "a", but what would happen if one use the special rule that "" returns as.raw(0) instead? Would that break much downstream? If one have it return as.raw(0), and add the rule that an empty input returns an empty output, then charToRaw(rawToChar(x)) [and vice versa rawToChar(charToRaw(x))] would always return 'x'. With R v2.7.0 we now have: > x <- raw(0) > identical(x, charToRaw(rawToChar(x))) [1] TRUE > x <- as.raw(0) > identical(x, charToRaw(rawToChar(x))) [1] TRUE but the latter will be FALSE in R v2.8.0 (because of the new rules on '\0'): > x <- as.raw(0) > identical(x, charToRaw(rawToChar(x))) [1] FALSE Warning message: In rawToChar(x) : truncating string with embedded nul: '\0' Just some thoughts. Cheers Henrik __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] rawToChar(raw(0))
On 5/21/08, Henrik Bengtsson <[EMAIL PROTECTED]> wrote: > Hi, > > right now we have (on R v2.7.0 patched (2008-04-23 r45466)) that: > > > rawToChar(raw(0)) > [1] "" > > rawToChar(raw(0), multiple=TRUE) > character(0) > > Is this intended or should both return character(0)? Personally, I > would prefer that an empty input vector returns an empty output > vector. I don't see why; rawToChar(, multiple=FALSE) is meant to be a map from an n-vector to a scalar. Why should there be an exception when n==0? Would you expect mean(numeric(0)) to return numeric(0)? > Same should then apply to charToRaw(), but right now we get: > > > x <- character(0) > > charToRaw(x) > Error in charToRaw(x) : argument must be a character vector of length 1 The error message says it all: charToRaw() maps a scalar to an n-vector. For vectors of length > 1, it uses the first element with a warning. No comments on the rest. -Deepayan > [...] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] rbind.data.frame drops attributes for factor variables
Dear R-devel - I noticed that when I rbind two data.frames together, factor variables lose their attributes in the resulting data.frame while numeric variables do not. As an example, create two data.frames, t1 and t2, with two variables each. Give each variable an attribute called "label", and then perform the rbind and look at the resulting structure. EXAMPLE R CODE # t1 <- data.frame(subject = 1:4, trt = factor(c("A","B","B","A"))) attr(t1$trt, "label") <- "Trt Label" attr(t1$subject, "label") <- "Subject Label" str(t1) t2 <- data.frame(subject = 5:8, trt = factor(c("A","A","A","A"))) attr(t2$trt, "label") <- "Trt Label" attr(t2$subject, "label") <- "Subject Label" str(t2) str(rbind(t1, t2)) END EXAMPLE R CODE # The output of the last line of code is: 'data.frame': 8 obs. of 2 variables: $ subject: atomic 1 2 3 4 5 6 7 8 ..- attr(*, "label")= chr "Subject Label" $ trt: Factor w/ 2 levels "A","B": 1 2 2 1 1 1 1 1 I do not see this documented anywhere in ?rbind, and do not know if it is intended. It looks like the factor loses its attributes in rbind.data.frame due to a call to as.vector. Of course, as.vector is documented to drop the attributes of atomic vector types. I do not know if this qualifies as a bug or intended since it is not stated in ?rbind what will happen. sessionInfo() is below. Best, Erik Iverson sessionInfo() R version 2.7.0 (2008-04-22) i686-pc-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] image (PR#11493)
Simon Urbanek wrote: On May 20, 2008, at 8:05 PM, [EMAIL PROTECTED] wrote: Full_Name: Joseph Scandura Version: 2.7.0 OS: Mac 10.5 Submission from: (NULL) (140.251.50.94) Since updating to 2.7.0 all plots that use image() (heatmap, etc...) now draw visible boxes around each rectangle in the plot. When there are many rectangles the surrounding color becomes dominant over the rectangle color and the overall image is borderline useless. Can you, please, specify exactly which graphics device you are using and possibly a snapshot of the problem? I don't see any additional boxes being drawn on any device. I see lines at the borders of the grid used by image on my Mac (Tiger, R 2.7.0 Patched (2008-05-20 r45743)). They are most visible in the last of the examples plotted by example(image), the one that starts image(x, y, volcano, col = terrain.colors(100), axes = FALSE). It opens a Quartz device. How do you do a snapshot on a Mac? I see online that it's Cmd-Shift-4, and I get the snapshot click, but I don't know where the picture ended up. The only issue I'm aware of are anti-aliasing effects around the edges of adjacent rectangles which don't fall on the pixel boundary (if anti- aliasing device is used). Depending on the subpixel location of the edge, the background color may shine through very slightly. It's not what you describe, but it's closest to what I can imagine you could mean. However, AFAICS this has not been changed recently and is a rendering artifact which is hard to get rid of in the current setup as devices are resolution-independent (the only cure I'm aware of [short of disabling anti-aliasing] is to distort the original plot such that rectangles are aligned with the pixels of the output medium). I don't know if what I'm seeing is new or not; I've only got one R version installed. Duncan Murdoch Cheers, Simon __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] image (PR#11493)
(Edited to add link to sample picture) Simon Urbanek wrote: On May 20, 2008, at 8:05 PM, [EMAIL PROTECTED] wrote: Full_Name: Joseph Scandura Version: 2.7.0 OS: Mac 10.5 Submission from: (NULL) (140.251.50.94) Since updating to 2.7.0 all plots that use image() (heatmap, etc...) now draw visible boxes around each rectangle in the plot. When there are many rectangles the surrounding color becomes dominant over the rectangle color and the overall image is borderline useless. Can you, please, specify exactly which graphics device you are using and possibly a snapshot of the problem? I don't see any additional boxes being drawn on any device. I see lines at the borders of the grid used by image on my Mac (Tiger, R 2.7.0 Patched (2008-05-20 r45743)). They are most visible in the last of the examples plotted by example(image), the one that starts image(x, y, volcano, col = terrain.colors(100), axes = FALSE). It opens a Quartz device. How do you do a snapshot on a Mac? I see online that it's Cmd-Shift-4, and I get the snapshot click, but I don't know where the picture ended up. AHA! It goes to the desktop. Okay, a sample picture is available at http://www.stats.uwo.ca/faculty/murdoch/temp/grid.png Not as bad as Joseph was describing, but not nearly as good as Windows produces ;-). The only issue I'm aware of are anti-aliasing effects around the edges of adjacent rectangles which don't fall on the pixel boundary (if anti- aliasing device is used). Depending on the subpixel location of the edge, the background color may shine through very slightly. It's not what you describe, but it's closest to what I can imagine you could mean. However, AFAICS this has not been changed recently and is a rendering artifact which is hard to get rid of in the current setup as devices are resolution-independent (the only cure I'm aware of [short of disabling anti-aliasing] is to distort the original plot such that rectangles are aligned with the pixels of the output medium). I don't know if what I'm seeing is new or not; I've only got one R version installed. Duncan Murdoch Cheers, Simon __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel