Dear r helpers,
In my exploration of the tcltk facilities of R I've had some success
but some failures, and wonder if someone could point me to a
solution. To begin:
******************************************************
> sessionInfo()
Version 2.3.1 (2006-06-01)
powerpc-apple-darwin8.6.0
attached base packages:
[1] "tcltk" "methods" "stats"
"graphics" "grDevices"
"utils" "datasets" "base"
other attached packages:
igraph
"0.1.2"
******************************************************
A success:
******************************************************
> library(tcltk)
> tt <- tktoplevel()
> tkpack(txt.w <- tktext(tt))
<Tcl>
> tkinsert(txt.w, "0.0", "plot(1:10)")
<Tcl>
>
> eval.txt <- function()
+ eval(parse(text=tclvalue(tkget(txt.w, "0.0", "end"))))
> tkpack(but.w <- tkbutton(tt,text="Submit", command=eval.txt))
<Tcl>
>
> tkdestroy(tt)
******************************************************
An interactive session ran successfully. One failure:
******************************************************
> library(gtkDevice)
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library '/Library/Frameworks/R.framework/
Versions/2.3/Resources/library/gtkDevice/libs/ppc/gtkDevice.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.3/Resources/
library/gtkDevice/libs/ppc/gtkDevice.so, 6): Symbol not found:
_gtk_main_quit
Referenced from: /Library/Frameworks/R.framework/Versions/2.3/
Resources/library/gtkDevice/libs/ppc/gtkDevice.so
Expected in: flat namespace
Error in library(gtkDevice) : .First.lib failed for 'gtkDevice'
******************************************************
and another:
******************************************************
> library(tkrplot)
Error in structure(.External("dotTcl", ..., PACKAGE =
"tcltk"), class
= "tclObj") :
[tcl] image not found
NSCreateObjectFileImageFromFile() error: not a Mach-O MH_BUNDLE file.
Error in library(tkrplot) : .First.lib failed for 'tkrplot'
******************************************************
I ran
> installed.packages()
the two relevant lines are:
Package LibPath Version Priority Bundle
gtkDevice "gtkDevice"
"/Library/Frameworks/R.framework/Versions/2.3/
Resources/library" "1.9-4" NA NA
tkrplot "tkrplot"
"/Library/Frameworks/R.framework/Versions/2.3/
Resources/library" "0.0-14" NA NA
******************************************************
I tried reinstalling gtkDevice from source, and got:
******************************************************
>
trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/
gtkDevice_1.9-4.tar.gz'
Content type 'application/x-gzip' length 41475 bytes
opened URL
=================================================downloaded 40Kb
WARNING: ignoring environment value of R_HOME
* Installing *source* package 'gtkDevice' ...
checking for gtk-config... no
checking for gtk12-config... no
ERROR: Cannot find gtk-config.
** Removing '/Library/Frameworks/R.framework/Versions/2.3/Resources/
library/gtkDevice'
** Restoring previous '/Library/Frameworks/R.framework/Versions/2.3/
Resources/library/gtkDevice'
The downloaded packages are in
/private/tmp/RtmpjNWS1J/downloaded_packages
ERROR: configuration failed for package 'gtkDevice'
******************************************************
I tried installing tkrplot from source, and that worked!
******************************************************
trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/
tkrplot_0.0-14.tar.gz'
Content type 'application/x-gzip' length 38339 bytes
opened URL
=================================================downloaded 37Kb
WARNING: ignoring environment value of R_HOME
* Installing *source* package 'tkrplot' ...
configure: creating ./config.status
config.status: creating src/Makevars
** libs
** arch - ppc
gcc-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include
-I/Library/Frameworks/R.framework/Resources/include/ppc -I/usr/local/
include -I/usr/local/include -I/usr/local/include -fPIC -fno-
common -g -O2 -std=gnu99 -c tcltkimg.c -o tcltkimg.o
gcc-4.0 -arch ppc -flat_namespace -bundle -undefined suppress -L/usr/
local/lib -o tkrplot.so tcltkimg.o -L/usr/local/lib -ltcl8.4 -L/usr/
local/lib -ltk8.4 -L/usr/X11R6/lib -lX11 -L/Library/Frameworks/
R.framework/Resources/lib/ppc -lR
** R
** help
>>> Building/Updating help pages for package 'tkrplot'
Formats: text html latex example
TkRplot text html latex example
** building package indices ...
* DONE (tkrplot)
The downloaded packages are in
/private/tmp/RtmpjNWS1J/downloaded_packages
******************************************************
But:
******************************************************
> library(tkrplot)
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Error in structure(.External("dotTcl", ..., PACKAGE =
"tcltk"), class
= "tclObj") :
[tcl] image not found
NSCreateObjectFileImageFromFile() error: not a Mach-O MH_BUNDLE file.
Error in library(tkrplot) : .First.lib failed for 'tkrplot'
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102 Gilmer Hall
McCormick Road Charlottesville, VA 22903
Office: B011 +1-434-982-4729
Lab: B019 +1-434-982-4751
Fax: +1-434-982-4766
WWW: http://www.people.virginia.edu/~mk9y/