[R] read variable global in R tcltk

Philippe Grosjean phgrosjean at sciviews.org
Tue Apr 22 09:49:21 CEST 2008


Read ?tclvalue.
For instance, you can do:
 > tclvalue("tcl_library")	# Read the content of a Tcl variable
[1] "/usr/local/lib/tcl8.4"
 > .Tcl("set myvar 1")		# Create a variable inside Tcl
<Tcl> 1
 > tclvalue("myvar")		# Read its value
[1] "1"

To make sure you create global variables in Tcl, start their names with 
'::', like '::myglobalvar', if you like.
Best,

Philippe Grosjean


Handayani Situmorang wrote:
> I have any problem with my code. I build a small GUI in R  with tcltk package. the proolem is I don't understand how to make a variable value can be read by R from a function. the variable value can only read if it's called via tcltk widgets and pass it to another function. i think the point is the variable must be set as global variable. but i don't have any idea? is anyone can help me, please? Thank you very much.  
> 
>        
> ---------------------------------
> Bergabunglah dengan orang-orang yang berwawasan, di bidang Anda di Yahoo! Answers
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list