[Rd] Quoting

Vladimir Dergachev vdergachev at rcgardis.com
Wed May 23 01:37:40 CEST 2007


On Tuesday 22 May 2007 7:05 pm, Peter Dalgaard wrote:
> Vladimir Dergachev wrote:
> >> I think DTL's suggestion would be most useful when putting a lot of code
> >> in a string, where the escapes make the code harder to read.  For
> >> example, just about any function using a complicated regular expression.
> >
> > Also anything using .Tcl(). Quotes in data frame definition are useful
> > because they could be employed to delimit text fields with spaces in
> > them.
>
> .Tcl() is usually the wrong solution anyway, you really should use tcl()
> unless absolutely necessary.
>

Actually I could not figure out how to use tcl() - it seems to work only to 
call a single Tcl/Tk command.

I mostly use .Tcl() to create guis along the lines of

foreach {control  desc var value} {
	label "Just a description" title1 0
	entry "Edit some text" text_var {Hello there}
	} {
	switch -exact -- $control {
		label { 
			label .l$var -text $desc
			grid .l$var - -sticky news
			}
		entry {
			label .l$var -text $desc
			entry .e$var -variable $var
			grid .l$var .e$var -sticky news
			global $var
			set $var $value
			}
	# other control types follow
		}
	}

this can get pretty versatile and works for plots and other things..

                          best

                              Vladimir Dergachev



More information about the R-devel mailing list