Re: [R] How do I change which R Graphics Device is active?

2009-07-01 Thread Mark Knecht
On Wed, Jul 1, 2009 at 7:45 AM, Barry Rowlingson wrote: > On Wed, Jul 1, 2009 at 3:30 PM, Don MacQueen wrote: >> My version would be >> >>  newDev <-  function() { dev.new(); invisible( dev.cur() ) } >> >> I agree with Hadley that return() is redundant in this instance. Using >> invisible() suppres

Re: [R] How do I change which R Graphics Device is active?

2009-07-01 Thread Barry Rowlingson
On Wed, Jul 1, 2009 at 3:30 PM, Don MacQueen wrote: > My version would be > >  newDev <-  function() { dev.new(); invisible( dev.cur() ) } > > I agree with Hadley that return() is redundant in this instance. Using > invisible() suppresses automatic printing of the returned value when it is > not be

Re: [R] How do I change which R Graphics Device is active?

2009-07-01 Thread Don MacQueen
My version would be newDev <- function() { dev.new(); invisible( dev.cur() ) } I agree with Hadley that return() is redundant in this instance. Using invisible() suppresses automatic printing of the returned value when it is not being assigned to a variable, thus making it more like dev.ne

Re: [R] How do I change which R Graphics Device is active?

2009-06-30 Thread hadley wickham
On Tue, Jun 30, 2009 at 2:12 PM, Barry Rowlingson wrote: > On Tue, Jun 30, 2009 at 8:05 PM, Mark Knecht wrote: > >> You could wrap it in a function of your own making, right? >> >> AddNewDev = function() {dev.new();AddNewDev=dev.cur()} >> >> histPlot=AddNewDev() >> >> Seems to work. > >  You leaRn

Re: [R] How do I change which R Graphics Device is active?

2009-06-30 Thread Mark Knecht
Oops sorry. Thanks BARRY! On Tue, Jun 30, 2009 at 12:14 PM, Mark Knecht wrote: > On Tue, Jun 30, 2009 at 12:12 PM, Barry > Rowlingson wrote: >> On Tue, Jun 30, 2009 at 8:05 PM, Mark Knecht wrote: >> >>> You could wrap it in a function of your own making, right? >>> >>> AddNewDev = function() {dev.

Re: [R] How do I change which R Graphics Device is active?

2009-06-30 Thread Mark Knecht
On Tue, Jun 30, 2009 at 12:12 PM, Barry Rowlingson wrote: > On Tue, Jun 30, 2009 at 8:05 PM, Mark Knecht wrote: > >> You could wrap it in a function of your own making, right? >> >> AddNewDev = function() {dev.new();AddNewDev=dev.cur()} >> >> histPlot=AddNewDev() >> >> Seems to work. > >  You leaRn

Re: [R] How do I change which R Graphics Device is active?

2009-06-30 Thread Barry Rowlingson
On Tue, Jun 30, 2009 at 8:05 PM, Mark Knecht wrote: > You could wrap it in a function of your own making, right? > > AddNewDev = function() {dev.new();AddNewDev=dev.cur()} > > histPlot=AddNewDev() > > Seems to work. You leaRn fast :) Probably better style is: newDev = function(){dev.new();retu

Re: [R] How do I change which R Graphics Device is active?

2009-06-30 Thread Mark Knecht
On Tue, Jun 30, 2009 at 11:45 AM, Barry Rowlingson wrote: > On Tue, Jun 30, 2009 at 6:33 PM, Ted > Harding wrote: > >> Barry, spot on! If there were a prize for postings with >> simplicity, clarity, conciseness and usability, I would nominate >> yours (especially in the "Why didn't *I* think of tha

Re: [R] How do I change which R Graphics Device is active?

2009-06-30 Thread Barry Rowlingson
On Tue, Jun 30, 2009 at 6:33 PM, Ted Harding wrote: > Barry, spot on! If there were a prize for postings with > simplicity, clarity, conciseness and usability, I would nominate > yours (especially in the "Why didn't *I* think of that?" category). Thanks Ted! It's just a shame dev.new() doesn't

Re: [R] How do I change which R Graphics Device is active?

2009-06-30 Thread Mark Knecht
On Tue, Jun 30, 2009 at 9:48 AM, Barry Rowlingson wrote: > On Tue, Jun 30, 2009 at 5:15 PM, milton ruser wrote: >> How about: >> >> dev.cur() >> dev.list() >> dev.next(which = dev.cur()) >> dev.prev(which = dev.cur()) >> dev.off(which = dev.cur()) >> dev.set(which = dev.next()) >> dev.new(...) >> g

Re: [R] How do I change which R Graphics Device is active?

2009-06-30 Thread Ted Harding
On 30-Jun-09 16:48:15, Barry Rowlingson wrote: > To keep track, call dev.cur() after creating a new plot > and assign it to something memorable. Here's how to keep > a histogram and an xy plot: > >> dev.new();histPlot = dev.cur() >> dev.new();xyPlot = dev.cur() >> dev.set(histPlot);hist(runif(100)

Re: [R] How do I change which R Graphics Device is active?

2009-06-30 Thread Barry Rowlingson
On Tue, Jun 30, 2009 at 5:15 PM, milton ruser wrote: > How about: > > dev.cur() > dev.list() > dev.next(which = dev.cur()) > dev.prev(which = dev.cur()) > dev.off(which = dev.cur()) > dev.set(which = dev.next()) > dev.new(...) > graphics.off() > dev.cur() > dev.list() > dev.next(which = dev.cur())

Re: [R] How do I change which R Graphics Device is active?

2009-06-30 Thread Mark Knecht
Thanks milton! Beautiful! Cheers, Mark On Tue, Jun 30, 2009 at 9:15 AM, milton ruser wrote: > How about: > > dev.cur() > dev.list() > dev.next(which = dev.cur()) > dev.prev(which = dev.cur()) > dev.off(which = dev.cur()) > dev.set(which = dev.next()) > dev.new(...) > graphics.off() > dev.cur() >

Re: [R] How do I change which R Graphics Device is active?

2009-06-30 Thread milton ruser
How about: dev.cur() dev.list() dev.next(which = dev.cur()) dev.prev(which = dev.cur()) dev.off(which = dev.cur()) dev.set(which = dev.next()) dev.new(...) graphics.off() dev.cur() dev.list() dev.next(which = dev.cur()) dev.prev(which = dev.cur()) dev.off(which = dev.cur()) dev.set(which = dev.nex

[R] How do I change which R Graphics Device is active?

2009-06-30 Thread Mark Knecht
Hello, If I execute X11() plot( stuff ) X11() plot( other stuff) then at this point I have two windows with plots and the second graphics window is active. I don't see the devices using ls(). 1) Without destroying the second window how do I make the first window active again? 2) How do I dest