Re: [R] Using tcltk or other graphical widgets to view zoo time series objects

2010-02-01 Thread Research
Many thanks Liviu!

Liviu Andronic wrote:
> On 2/1/10, Research  wrote:
>   
>> do_something_else = function(playstate) ###Export here mean value of 
>> sequence playState$env$i###
>>
>> 
>
> Would this do the trick?
> playwith(xyplot(dat[,c(1,i)]),  parameters = list(i = 1:100,
> do_something = function(playState) print(playState$env$i),
> do_something_else = function(playState) print(mean(dat[, 
> playState$env$i])),
> do_something_diff = function(playState) {
> assign("x", mean(dat[, playState$env$i]), envir = .GlobalEnv)
> print(x)
> }
> )
> )
>
>
> Liviu
>
> __ Information from ESET Smart Security, version of virus signature 
> database 4823 (20100201) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>
>
>   




__ Information from ESET Smart Security, version of virus signature 
database 4823 (20100201) __

The message was checked by ESET Smart Security.

http://www.eset.com


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using tcltk or other graphical widgets to view zoo time series objects

2010-02-01 Thread Liviu Andronic
On 2/1/10, Research  wrote:
> do_something_else = function(playstate) ###Export here mean value of 
> sequence playState$env$i###
>

Would this do the trick?
playwith(xyplot(dat[,c(1,i)]),  parameters = list(i = 1:100,
do_something = function(playState) print(playState$env$i),
do_something_else = function(playState) print(mean(dat[, playState$env$i])),
do_something_diff = function(playState) {
assign("x", mean(dat[, playState$env$i]), envir = .GlobalEnv)
print(x)
}
)
)


Liviu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using tcltk or other graphical widgets to view zoo time series objects

2010-02-01 Thread Felix Andrews
You could either call a function, passing the value, or assign it to a
variable in the workspace like
.GlobalEnv$foo <- playState$env$i

Note that this `i' is one number, not a sequence, so you can't take the mean.

-Felix


On 1 February 2010 20:57, Research  wrote:
> Dear Felix,
>
> Thanks. That was most useful. I am having trouble though exporting values of
> variables to the R environment from within the playwith.
>
> Say I need to do a claculation by setting up an extra  button within
>
> playwith(xyplot(dat[,c(1,i)]),  parameters = list(i = 1:100,
> do_something = function(playState) print(playState$env$i),
> do_something_else = function(playstate) ###Export here mean value of
> sequence playState$env$i###
> )
> )
>
> Can I pass the value of this to the rest of R ? I could not find something
> in the help pages. Can you direct me to it please?
>
> Thanks +
>
> Best regards,
> Costas
>
> Felix Andrews wrote:
>
> The playwith package might help, though if I understand the problem
> correctly, the help(xyplot.zoo) example is not so relevant. If you
> want to switch between many series you could use a spin-button or
> somesuch. To execute a function you can create a button.
>
> If you have a hundred-column dataset like
> dat <- zoo(matrix(rnorm(100*100),ncol=100), Sys.Date()+1:100)
> colnames(dat) <- paste("Series", 1:100)
>
> Then this will give you a spin button to choose the column to plot,
> and a button to print out the current series number.
>
> playwith(xyplot(dat[,c(1,i)]),  parameters = list(i = 1:100,
> do_something = function(playState) print(playState$env$i))
> )
>
> Note that the playwith package uses RGtk2, and therefore requires the
> GTK+ libraries to be installed on your system.
>
>
>
> On 28 January 2010 23:16, Gabor Grothendieck 
> wrote:
>
>
> There is an example of using zoo together with the playwith package at
> the end of the examples section of help(xyplot.zoo) which may address
> this.
>
> On Thu, Jan 28, 2010 at 7:10 AM, Research  wrote:
>
>
> Dear all,
>
> I am looking at the R-help entry below:
>
> http://finzi.psych.upenn.edu/R/Rhelp02/archive/26640.html
>
> I have a more complicatedt problem. I have a zoo time series frame with 100+
> sequences.
>
> I want to cycle through them back and forth and compare them to the 1st
> column at any time.
>
> I need also a button to click when I need the viewed-selected sequence (that
> is being compared to the 1st column one) to be manipulated
> (by some algorithm or be saved individually etc. etc.)...
>
> I am trying to modify the code at the above link but somehow I can not make
> it to work with zoo time series objects.
>
>
> Any help would be greatly appreciated.
>
> Thanks in advance,
> Costas
>
>
> __ Information from ESET Smart Security, version of virus signature
> database 4813 (20100128) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>
>
>
> __ Information from ESET Smart Security, version of virus signature
> database 4823 (20100201) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>



-- 
Felix Andrews / 安福立
Postdoctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 4670
E: felix.andr...@anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using tcltk or other graphical widgets to view zoo time series objects

2010-02-01 Thread Research
Dear Felix,

Thanks. That was most useful. I am having trouble though exporting 
values of variables to the R environment from within the playwith.

Say I need to do a claculation by setting up an extra  button within

playwith(xyplot(dat[,c(1,i)]),  parameters = list(i = 1:100,
do_something = function(playState) print(playState$env$i),
do_something_else = function(playstate) ###Export here mean value of 
sequence playState$env$i###
)
)

Can I pass the value of this to the rest of R ? I could not find 
something in the help pages. Can you direct me to it please?

Thanks +

Best regards,
Costas

Felix Andrews wrote:
> The playwith package might help, though if I understand the problem
> correctly, the help(xyplot.zoo) example is not so relevant. If you
> want to switch between many series you could use a spin-button or
> somesuch. To execute a function you can create a button.
>
> If you have a hundred-column dataset like
> dat <- zoo(matrix(rnorm(100*100),ncol=100), Sys.Date()+1:100)
> colnames(dat) <- paste("Series", 1:100)
>
> Then this will give you a spin button to choose the column to plot,
> and a button to print out the current series number.
>
> playwith(xyplot(dat[,c(1,i)]),  parameters = list(i = 1:100,
> do_something = function(playState) print(playState$env$i))
> )
>
> Note that the playwith package uses RGtk2, and therefore requires the
> GTK+ libraries to be installed on your system.
>
>
>
> On 28 January 2010 23:16, Gabor Grothendieck  wrote:
>   
>> There is an example of using zoo together with the playwith package at
>> the end of the examples section of help(xyplot.zoo) which may address
>> this.
>>
>> On Thu, Jan 28, 2010 at 7:10 AM, Research  wrote:
>> 
>>> Dear all,
>>>
>>> I am looking at the R-help entry below:
>>>
>>> http://finzi.psych.upenn.edu/R/Rhelp02/archive/26640.html
>>>
>>> I have a more complicatedt problem. I have a zoo time series frame with 100+
>>> sequences.
>>>
>>> I want to cycle through them back and forth and compare them to the 1st
>>> column at any time.
>>>
>>> I need also a button to click when I need the viewed-selected sequence (that
>>> is being compared to the 1st column one) to be manipulated
>>> (by some algorithm or be saved individually etc. etc.)...
>>>
>>> I am trying to modify the code at the above link but somehow I can not make
>>> it to work with zoo time series objects.
>>>
>>>
>>> Any help would be greatly appreciated.
>>>
>>> Thanks in advance,
>>> Costas
>>>
>>>
>>> __ Information from ESET Smart Security, version of virus signature
>>> database 4813 (20100128) __
>>>
>>> The message was checked by ESET Smart Security.
>>>
>>> http://www.eset.com
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>   
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>> 
>
>
>
>   




__ Information from ESET Smart Security, version of virus signature 
database 4823 (20100201) __

The message was checked by ESET Smart Security.

http://www.eset.com


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using tcltk or other graphical widgets to view zoo time series objects

2010-01-28 Thread j verzani
Research  ath.forthnet.gr> writes:

> 
> Dear all,
> 
> I am looking at the R-help entry below:
> 
> http://finzi.psych.upenn.edu/R/Rhelp02/archive/26640.html
> 
> I have a more complicatedt problem. I have a zoo time series frame with 
> 100+ sequences.
> 
> I want to cycle through them back and forth and compare them to the 1st 
> column at any time.
> 

The playwith solution is shorter but this GUI mockup using gWidgets might be
more flexible:

library(gWidgets)

make_plot <- function(i, ...) {
  ## your plot goes here
  cat(i)
  plot(1, i)
}
do_something <- function(i,..) {
  cat("clicked on", i, "\n")
}

w <- gwindow("Plot example")
g <- ggroup(cont=w, horizontal=FALSE)
i <- gslider(from=2, to=100, by=1, cont=g, handler=function(h,...) {
  make_plot(svalue(h$obj))
})
b <- gbutton("do something", cont=g, handler=function(h,...) {
  do_something(svalue(i))
})


That will work with tcltk and RGtk2. If you have RGtk2 installed, then you might
also like this GUI template using traitr:


library(gWidgets)
options(guiToolkit="RGtk2")
require(traitr)

dlg <- aDialog(items=list(
 i=rangeItem(value=2, from=2, to=100, by=1),
 g=graphicDeviceItem()
 ),
   buttons="Details...",
   property_i_value_changed=function(., value, old_value) {
 make_plot(value)
   },
   Details_handler = function(.) {
 do_something(.$to_R()$i)
   })
dlg$make_gui()
 
 




> I need also a button to click when I need the viewed-selected sequence 
> (that is being compared to the 1st column one) to be manipulated
> (by some algorithm or be saved individually etc. etc.)...
> 
> I am trying to modify the code at the above link but somehow I can not 
> make it to work with zoo time series objects.
> 
> Any help would be greatly appreciated.
> 
> Thanks in advance,
> Costas
> 
> __ Information from ESET Smart Security, version of virus signature
database 4813 (20100128) __
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.com
> 
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using tcltk or other graphical widgets to view zoo time series objects

2010-01-28 Thread Felix Andrews
The playwith package might help, though if I understand the problem
correctly, the help(xyplot.zoo) example is not so relevant. If you
want to switch between many series you could use a spin-button or
somesuch. To execute a function you can create a button.

If you have a hundred-column dataset like
dat <- zoo(matrix(rnorm(100*100),ncol=100), Sys.Date()+1:100)
colnames(dat) <- paste("Series", 1:100)

Then this will give you a spin button to choose the column to plot,
and a button to print out the current series number.

playwith(xyplot(dat[,c(1,i)]),  parameters = list(i = 1:100,
do_something = function(playState) print(playState$env$i))
)

Note that the playwith package uses RGtk2, and therefore requires the
GTK+ libraries to be installed on your system.



On 28 January 2010 23:16, Gabor Grothendieck  wrote:
> There is an example of using zoo together with the playwith package at
> the end of the examples section of help(xyplot.zoo) which may address
> this.
>
> On Thu, Jan 28, 2010 at 7:10 AM, Research  wrote:
>> Dear all,
>>
>> I am looking at the R-help entry below:
>>
>> http://finzi.psych.upenn.edu/R/Rhelp02/archive/26640.html
>>
>> I have a more complicatedt problem. I have a zoo time series frame with 100+
>> sequences.
>>
>> I want to cycle through them back and forth and compare them to the 1st
>> column at any time.
>>
>> I need also a button to click when I need the viewed-selected sequence (that
>> is being compared to the 1st column one) to be manipulated
>> (by some algorithm or be saved individually etc. etc.)...
>>
>> I am trying to modify the code at the above link but somehow I can not make
>> it to work with zoo time series objects.
>>
>>
>> Any help would be greatly appreciated.
>>
>> Thanks in advance,
>> Costas
>>
>>
>> __ Information from ESET Smart Security, version of virus signature
>> database 4813 (20100128) __
>>
>> The message was checked by ESET Smart Security.
>>
>> http://www.eset.com
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Felix Andrews / 安福立
Postdoctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 4670
E: felix.andr...@anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using tcltk or other graphical widgets to view zoo time series objects

2010-01-28 Thread Gabor Grothendieck
There is an example of using zoo together with the playwith package at
the end of the examples section of help(xyplot.zoo) which may address
this.

On Thu, Jan 28, 2010 at 7:10 AM, Research  wrote:
> Dear all,
>
> I am looking at the R-help entry below:
>
> http://finzi.psych.upenn.edu/R/Rhelp02/archive/26640.html
>
> I have a more complicatedt problem. I have a zoo time series frame with 100+
> sequences.
>
> I want to cycle through them back and forth and compare them to the 1st
> column at any time.
>
> I need also a button to click when I need the viewed-selected sequence (that
> is being compared to the 1st column one) to be manipulated
> (by some algorithm or be saved individually etc. etc.)...
>
> I am trying to modify the code at the above link but somehow I can not make
> it to work with zoo time series objects.
>
>
> Any help would be greatly appreciated.
>
> Thanks in advance,
> Costas
>
>
> __ Information from ESET Smart Security, version of virus signature
> database 4813 (20100128) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Using tcltk or other graphical widgets to view zoo time series objects

2010-01-28 Thread Research

Dear all,

I am looking at the R-help entry below:

http://finzi.psych.upenn.edu/R/Rhelp02/archive/26640.html

I have a more complicatedt problem. I have a zoo time series frame with 
100+ sequences.


I want to cycle through them back and forth and compare them to the 1st 
column at any time.


I need also a button to click when I need the viewed-selected sequence 
(that is being compared to the 1st column one) to be manipulated

(by some algorithm or be saved individually etc. etc.)...

I am trying to modify the code at the above link but somehow I can not 
make it to work with zoo time series objects.



Any help would be greatly appreciated.

Thanks in advance,
Costas


__ Information from ESET Smart Security, version of virus signature 
database 4813 (20100128) __

The message was checked by ESET Smart Security.

http://www.eset.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.