Hi Miles,
I think you want to use parentheses at the end of the command:
AmeliaView()
Hope that helps!
Cheers,
Matt
On Sun, Mar 22, 2015 at 11:15 PM, Miles M Evers <mevers(a)gwu.edu> wrote:
Hi All,
I’m trying to use AmeliaView in RStudio on Mac Yosemite OS X 10.10.2. Every time I enter
AmeliaView into the console, however, I receive the following message below rather than
the interface popping up. Please help!
AmeliaView
function ()
{
require(tcltk) || stop("The package 'tcltk' is required")
if (.Platform$OS.type != "windows") {
tcltk::tcl("ttk::style", "theme", "use",
"clam")
tcltk::tkfont.configure("TkHeadingFont", weight = "normal")
tcltk::tkfont.configure("TkCaptionFont", weight = "normal")
}
if (file.access(getwd(), mode = 2) == -1) {
if (file.access(Sys.getenv("HOME"), mode = 0) == 0 &
file.access(Sys.getenv("HOME"), mode = 2) == 0) {
setwd(Sys.getenv("HOME"))
}
}
tcltk::tclServiceMode(on = FALSE)
putAmelia("outname", tcltk::tclVar("outdata"))
putAmelia("outnum", tcltk::tclVar("5"))
putAmelia("empri", tcltk::tclVar("0"))
putAmelia("tol", tcltk::tclVar("0.0001"))
putAmelia("amelia.data", NULL)
putAmelia("am.filename", NULL)
putAmelia("varnames", NULL)
putAmelia("tsvar", NULL)
putAmelia("csvar", NULL)
putAmelia("varmin", NULL)
putAmelia("varmax", NULL)
putAmelia("runState", "noimps")
putAmelia("session.flag", FALSE)
putAmelia("intercs", tcltk::tclVar("0"))
putAmelia("splinestime", tcltk::tclVar("0"))
putAmelia("outtype", tcltk::tclVar("1"))
putAmelia("max.resample", tcltk::tclVar("1000"))
putAmelia("inname", tcltk::tclVar(""))
putAmelia("seed", tcltk::tclVar(""))
putAmelia("output.log", NULL)
putAmelia("boundMin", tcltk::tclVar(""))
putAmelia("boundMax", tcltk::tclVar(""))
putAmelia("wdForLastImputation", getwd())
output.types <- c("(no save)", "CSV", "Tab
Delimited", "Stata 6",
"Stata 7", "Stata 8/9", "Stata 10+", "Stata
10+ (stacked)",
"RData")
ampath <- find.package(package = "Amelia")[1]
ameliaFile <- file.path(ampath, "gui/gallery19.gif")
goFile <- file.path(ampath, "gui/action_go.gif")
tableFile <- file.path(ampath, "gui/table.gif")
rFile <- file.path(ampath, "gui/page-R.gif")
dtaFile <- file.path(ampath, "gui/page_dta.gif")
spssFile <- file.path(ampath, "gui/page_spss.gif")
clockFile <- file.path(ampath, "gui/icon_clock.gif")
userFile <- file.path(ampath, "gui/icon_user.gif")
upFile <- file.path(ampath, "gui/arrow_up.gif")
downFile <- file.path(ampath, "gui/arrow_down.gif")
worldFile <- file.path(ampath, "gui/icon_world.gif")
pageTextFile <- file.path(ampath, "gui/page_text.gif")
pageEditFile <- file.path(ampath, "gui/page_edit.gif")
histFile <- file.path(ampath, "gui/histogram.gif")
saveFile <- file.path(ampath, "gui/action_save.gif")
pageUpFile <- file.path(ampath, "gui/page_up.gif")
redStopFile <- file.path(ampath, "gui/action_stop.gif")
redFlagFile <- file.path(ampath, "gui/flag_red.gif")
greenCheckFile <- file.path(ampath, "gui/icon_accept.gif")
putAmelia("ameliaPic", tcltk::tkimage.create("photo", file =
ameliaFile))
putAmelia("action.go.icon", tcltk::tkimage.create("photo",
file = goFile))
putAmelia("tablePic", tcltk::tkimage.create("photo", file =
tableFile))
putAmelia("rPic", tcltk::tkimage.create("photo", file = rFile))
putAmelia("dtaPic", tcltk::tkimage.create("photo", file =
dtaFile))
putAmelia("spssPic", tcltk::tkimage.create("photo", file =
spssFile))
putAmelia("clockIcon", tcltk::tkimage.create("photo", file =
clockFile))
putAmelia("userIcon", tcltk::tkimage.create("photo", file =
userFile))
putAmelia("worldIcon", tcltk::tkimage.create("photo", file =
worldFile))
putAmelia("upArrowIcon", tcltk::tkimage.create("photo", file =
upFile))
putAmelia("downArrowIcon", tcltk::tkimage.create("photo",
file = downFile))
putAmelia("histIcon", tcltk::tkimage.create("photo", file =
histFile))
putAmelia("saveIcon", tcltk::tkimage.create("photo", file =
saveFile))
putAmelia("pageUpIcon", tcltk::tkimage.create("photo", file =
pageUpFile))
putAmelia("redFlagIcon", tcltk::tkimage.create("photo", file =
redFlagFile))
putAmelia("redStopIcon", tcltk::tkimage.create("photo", file =
redStopFile))
putAmelia("greenCheckIcon", tcltk::tkimage.create("photo",
file = greenCheckFile))
putAmelia("pageTextIcon", tcltk::tkimage.create("photo",
file = pageTextFile))
putAmelia("pageEditIcon", tcltk::tkimage.create("photo",
file = pageEditFile))
putAmelia("gui", tcltk::tktoplevel())
tcltk::tkwm.title(getAmelia("gui"), "AmeliaView")
tcltk::tkwm.protocol(getAmelia("gui"), "WM_DELETE_WINDOW",
function() main.close())
tcltk::tkwm.geometry(getAmelia("gui"), "800x500")
putAmelia("main.menu", tcltk::tkmenu(getAmelia("gui")))
putAmelia("main.menu.file",
tcltk::tkmenu(getAmelia("main.menu"),
tearoff = 0))
putAmelia("main.menu.demo",
tcltk::tkmenu(getAmelia("main.menu"),
tearoff = 0))
putAmelia("main.menu.import",
tcltk::tkmenu(getAmelia("main.menu"),
tearoff = 0))
putAmelia("main.menu.options",
tcltk::tkmenu(getAmelia("main.menu"),
tearoff = 0))
putAmelia("main.menu.splines",
tcltk::tkmenu(getAmelia("main.menu"),
tearoff = 0))
putAmelia("main.menu.output",
tcltk::tkmenu(getAmelia("main.menu"),
tearoff = 0))
putAmelia("main.menu.help",
tcltk::tkmenu(getAmelia("main.menu"),
tearoff = 0))
putAmelia("main.menu.variables",
tcltk::tkmenu(getAmelia("main.menu"),
tearoff = 0, postcommand = variableOptionsPost))
putAmelia("main.menu.trans",
tcltk::tkmenu(getAmelia("main.menu"),
tearoff = 0))
putAmelia("main.menu.outfile",
tcltk::tkmenu(getAmelia("main.menu"),
tearoff = 0))
tcltk::tkadd(getAmelia("main.menu.file"), "command", label =
"Load R Data File...",
command = function() loadRData(), underline = 5)
tcltk::tkadd(getAmelia("main.menu.import"), "command", label =
"Import comma-separated value data...",
command = loadCSV, underline = 7)
tcltk::tkadd(getAmelia("main.menu.import"), "command", label =
"Import tab-delimited data...",
command = loadTAB, underline = 7)
tcltk::tkadd(getAmelia("main.menu.import"), "command", label =
"Import Stata dta file...",
command = loadStata, underline = 13)
tcltk::tkadd(getAmelia("main.menu.import"), "command", label =
"Import SPSS data...",
command = loadSPSS, underline = 7)
tcltk::tkadd(getAmelia("main.menu.import"), "command", label =
"Import SAS Transport data...",
command = loadSAS, underline = 8)
tcltk::tkadd(getAmelia("main.menu.file"), "cascade", menu =
getAmelia("main.menu.import"),
label = "Import Data", underline = 0)
tcltk::tkadd(getAmelia("main.menu.demo"), "command", label =
"africa",
command = function() loadDemo(name = "africa"), underline = 0)
tcltk::tkadd(getAmelia("main.menu.demo"), "command", label =
"freetrade",
command = function() loadDemo(name = "freetrade"), underline = 0)
tcltk::tkadd(getAmelia("main.menu.file"), "cascade", menu =
getAmelia("main.menu.demo"),
label = "Load Package Data", underline = 5)
tcltk::tkadd(getAmelia("main.menu.file"), "command", command =
setWorkingDir,
label = "Set Working Directory...", underline = 4)
tcltk::tkadd(getAmelia("main.menu.file"), "command", label =
"Edit Data...",
command = function() {
putAmelia("amelia.data", edit(getAmelia("amelia.data")))
updateTreeStats()
}, state = "disabled", underline = 0)
tcltk::tkadd(getAmelia("main.menu.file"), "separator")
tcltk::tkadd(getAmelia("main.menu.file"), "command", label =
"Load Session...",
command = function() load.session(), underline = 0)
tcltk::tkadd(getAmelia("main.menu.file"), "command", label =
"Save Session...",
command = function() save.session(), state = "disabled",
underline = 0)
tcltk::tkadd(getAmelia("main.menu.file"), "separator")
tcltk::tkadd(getAmelia("main.menu.file"), "command", label =
"Quit Amelia",
command = function() main.close(), underline = 0)
tcltk::tkadd(getAmelia("main.menu.variables"), "command",
label = "Set as Time-Series Variable", command = setTS,
state = "disabled", underline = 0)
tcltk::tkadd(getAmelia("main.menu.variables"), "command",
label = "Set as Cross-Section Variable", command = setCS,
state = "disabled", underline = 7)
tcltk::tkadd(getAmelia("main.menu.variables"), "command",
label = "Unset as Time-Series Variable", command = unsetTS,
state = "disabled", underline = 0)
tcltk::tkadd(getAmelia("main.menu.variables"), "command",
label = "Unset as Cross-Section Variable", command = unsetCS,
state = "disabled", underline = 23)
tcltk::tkadd(getAmelia("main.menu.variables"), "separator")
tcltk::tkadd(getAmelia("main.menu.variables"), "command",
label = "Add Lag", command = function() addLag(), state =
"disabled",
underline = 0)
tcltk::tkadd(getAmelia("main.menu.variables"), "command",
label = "Add Lead", command = function() addLead(), state =
"disabled",
underline = 4)
tcltk::tkadd(getAmelia("main.menu.variables"), "command",
label = "Remove Lag", command = function() dropLag(),
state = "disabled", underline = 0)
tcltk::tkadd(getAmelia("main.menu.variables"), "command",
label = "Remove Lead", command = function() dropLead(),
state = "disabled", underline = 1)
tcltk::tkadd(getAmelia("main.menu.variables"), "separator")
tcltk::tkadd(getAmelia("main.menu.variables"), "command",
label = "Plot Histogram(s) of Selected", command = plotHist,
state = "disabled", underline = 0)
tcltk::tkadd(getAmelia("main.menu.trans"), "command", label =
"Log",
command = function(x) setTrans("logs"), underline = 0)
tcltk::tkadd(getAmelia("main.menu.trans"), "command", label =
"Square Root",
command = function(x) setTrans("sqrt"), underline = 0)
tcltk::tkadd(getAmelia("main.menu.trans"), "command", label =
"Logistic",
command = function(x) setTrans("lgstc"), underline = 1)
tcltk::tkadd(getAmelia("main.menu.trans"), "command", label =
"Nominal",
command = function(x) setTrans("noms"), underline = 0)
tcltk::tkadd(getAmelia("main.menu.trans"), "command", label =
"Ordinal",
command = function(x) setTrans("ords"), underline = 0)
tcltk::tkadd(getAmelia("main.menu.trans"), "command", label =
"ID Variable",
command = function(x) setTrans("idvar"), underline = 0)
tcltk::tkadd(getAmelia("main.menu.variables"), "cascade",
label = "Add Transformation...", menu =
getAmelia("main.menu.trans"),
state = "disabled", underline = 4)
tcltk::tkadd(getAmelia("main.menu.variables"), "command",
label = "Remove Transformations", command = dropTrans,
state = "disabled", underline = 2)
tcltk::tkadd(getAmelia("main.menu.variables"), "separator")
tcltk::tkadd(getAmelia("main.menu.variables"), "command",
label = "Add or Edit Bounds", command = addBounds, state =
"disabled",
underline = 12)
for (i in 0:10) tcltk::tkadd(getAmelia("main.menu.splines"),
"radiobutton", variable = getAmelia("splinestime"), label =
paste(i,
"knots"), value = i, underline = 0)
tcltk::tkadd(getAmelia("main.menu.options"), "cascade", label =
"Splines of Time with...",
menu = getAmelia("main.menu.splines"), state = "disabled",
underline = 0)
tcltk::tkadd(getAmelia("main.menu.options"), "checkbutton",
label = "Interact Spline With Cross-Section?", variable =
getAmelia("intercs"),
onvalue = 1, offvalue = 0, state = "disabled", underline = 0)
tcltk::tkadd(getAmelia("main.menu.options"), "separator")
tcltk::tkadd(getAmelia("main.menu.options"), "command", label =
"Add Observations Priors...",
command = gui.pri.setup, state = "disabled", underline = 17)
tcltk::tkadd(getAmelia("main.menu.options"), "separator")
tcltk::tkadd(getAmelia("main.menu.options"), "command", label =
"Numerical Options",
command = buildNumericalOptions, state = "disabled",
underline = 0)
tcltk::tkadd(getAmelia("main.menu.options"), "command", label =
"Draw Missingness Map",
command = drawMissMap, state = "disabled", underline = 5)
tcltk::tkadd(getAmelia("main.menu.options"), "command", label =
"Output File Options...",
command = buildOutputOptions, state = "disabled", underline = 0)
for (i in 1:length(output.types)) {
tcltk::tkadd(getAmelia("main.menu.outfile"), "radiobutton",
variable = getAmelia("outtype"), label = output.types[i],
value = i - 1)
}
tcltk::tkadd(getAmelia("main.menu.options"), "cascade", label =
"Output File Type...",
menu = getAmelia("main.menu.outfile"), state = "disabled",
underline = 7)
tcltk::tkadd(getAmelia("main.menu.output"), "command", label =
"Imputation Diagnostics...",
command = gui.diag.setup, state = "disabled", underline = 11)
tcltk::tkadd(getAmelia("main.menu.output"), "command", label =
"Output Log",
command = show.output.log, state = "disabled", underline = 0)
tcltk::tkadd(getAmelia("main.menu.output"), "command", label =
"Open Folder Containing Imputated Data",
command = showImputedFiles, state = "disabled", underline = 12)
tcltk::tkadd(getAmelia("main.menu.help"), "command", label =
"Amelia Website",
command = function()
browseURL("http://gking.harvard.edu/amelia/")ia/"),
underline = 7)
tcltk::tkadd(getAmelia("main.menu.help"), "command", label =
"Documentation",
command = function()
browseURL("http://gking.harvard.edu/amelia/docs/")cs/"),
underline = 0)
tcltk::tkadd(getAmelia("main.menu.help"), "command", label =
"About...",
command = function() buildAboutDialog(), underline = 0)
tcltk::tkadd(getAmelia("main.menu"), "cascade", label =
"File",
menu = getAmelia("main.menu.file"), underline = 0)
tcltk::tkadd(getAmelia("main.menu"), "cascade", label =
"Variables",
menu = getAmelia("main.menu.variables"), underline = 0)
tcltk::tkadd(getAmelia("main.menu"), "cascade", label =
"Options",
menu = getAmelia("main.menu.options"), underline = 0)
tcltk::tkadd(getAmelia("main.menu"), "cascade", label =
"Output",
menu = getAmelia("main.menu.output"), underline = 1)
tcltk::tkadd(getAmelia("main.menu"), "cascade", label =
"Help",
menu = getAmelia("main.menu.help"), underline = 0)
tcltk::tkconfigure(getAmelia("gui"), menu =
getAmelia("main.menu"))
putAmelia("gui.welcome", tcltk::ttkframe(getAmelia("gui")))
ameliaPicLabel <- tcltk::ttklabel(getAmelia("gui.welcome"),
relief = "groove", image = getAmelia("ameliaPic"))
loadRButton <- tcltk::ttkbutton(getAmelia("gui.welcome"),
text = "Load R Data", image = getAmelia("rPic"), compound =
"top",
command = loadRData)
loadCSVButton <- tcltk::ttkbutton(getAmelia("gui.welcome"),
text = "Import CSV", image = getAmelia("tablePic"), compound
= "top",
command = loadCSV)
loadStataButton <- tcltk::ttkbutton(getAmelia("gui.welcome"),
text = "Import STATA", image = getAmelia("dtaPic"), compound
= "top",
command = loadStata)
loadSPSSButton <- tcltk::ttkbutton(getAmelia("gui.welcome"),
text = "Import SPSS", image = getAmelia("spssPic"), compound
= "top",
command = loadSPSS)
loadDemoButton <- tcltk::ttkbutton(getAmelia("gui.welcome"),
text = "Load Demo", image = getAmelia("tablePic"), compound =
"top",
command = function() loadDemo(name = "africa"))
tcltk::tkgrid(ameliaPicLabel, row = 0, column = 0, columnspan = 6,
padx = 10, pady = 10)
tcltk::tkgrid(tcltk::ttklabel(getAmelia("gui.welcome"), text =
paste("Welcome to AmeliaView ",
packageDescription("Amelia", fields = "Version"),
"!",
sep = "")), row = 1, column = 0, columnspan = 6, padx = 10,
pady = 10)
tcltk::tkgrid(tcltk::ttklabel(getAmelia("gui.welcome"), text = "Please
load a dataset:"),
row = 2, column = 0, columnspan = 6, padx = 10, pady = 10)
tcltk::tkgrid(loadRButton, row = 3, column = 0, padx = 10,
pady = 10)
tcltk::tkgrid(loadCSVButton, row = 3, column = 1, padx = 10,
pady = 10)
tcltk::tkgrid(loadStataButton, row = 3, column = 2, padx = 10,
pady = 10)
tcltk::tkgrid(loadSPSSButton, row = 3, column = 3, padx = 10,
pady = 10)
tcltk::tkgrid(loadDemoButton, row = 3, column = 4, padx = 10,
pady = 10)
tcltk::tkgrid(getAmelia("gui.welcome"), row = 0, column = 0)
putAmelia("gui.skel", tcltk::ttkpanedwindow(getAmelia("gui"),
orient = "vertical"))
toolbar <- tcltk::ttkframe(getAmelia("gui.skel"))
putAmelia("loadSessionButton", tcltk::ttkbutton(toolbar,
text = "Load Session", command = load.session, image =
getAmelia("pageUpIcon"),
compound = "top", style = "Toolbutton"))
putAmelia("saveSessionButton", tcltk::ttkbutton(toolbar,
text = "Save Session", command = save.session, image =
getAmelia("saveIcon"),
compound = "top", style = "Toolbutton"))
putAmelia("plotHistButton", tcltk::ttkbutton(toolbar, text = "Plot
Histogram",
state = "disabled", command = plotHist, image =
getAmelia("histIcon"),
compound = "top", style = "Toolbutton"))
putAmelia("editDataButton", tcltk::ttkbutton(toolbar, text = "Edit
Data",
state = "disabled", command = function() {
putAmelia("amelia.data", edit(getAmelia("amelia.data")))
updateTreeStats()
}, image = getAmelia("pageEditIcon"), compound = "top",
style = "Toolbutton"))
putAmelia("missmapButton", tcltk::ttkbutton(toolbar, text =
"Missingness Map",
state = "disabled", command = drawMissMap, image =
getAmelia("worldIcon"),
compound = "top", style = "Toolbutton"))
putAmelia("output.run", tcltk::ttkbutton(toolbar, text =
"Impute!",
state = "disabled", command = run.amelia, image =
getAmelia("action.go.icon"),
compound = "top", style = "Toolbutton"))
putAmelia("showLogButton", tcltk::ttkbutton(toolbar, text = "Output
Log",
state = "disabled", command = show.output.log, image =
getAmelia("pageTextIcon"),
compound = "top", style = "Toolbutton"))
tcltk::tkgrid(getAmelia("loadSessionButton"), row = 0, column = 0,
sticky = "ew")
tcltk::tkgrid(getAmelia("saveSessionButton"), row = 0, column = 1,
sticky = "ew")
tcltk::tkgrid(tcltk::ttkseparator(toolbar, orient = "vertical"),
row = 0, column = 2, padx = 5, pady = 5, sticky = "ns")
tcltk::tkgrid(getAmelia("plotHistButton"), row = 0, column = 3,
sticky = "ew")
tcltk::tkgrid(getAmelia("editDataButton"), row = 0, column = 4,
sticky = "ew")
tcltk::tkgrid(getAmelia("missmapButton"), row = 0, column = 5,
sticky = "ew")
tcltk::tkgrid(tcltk::ttkseparator(toolbar, orient = "vertical"),
row = 0, column = 6, padx = 5, pady = 5, sticky = "ns")
tcltk::tkgrid(getAmelia("output.run"), row = 0, column = 7,
sticky = "ew")
tcltk::tkgrid(getAmelia("showLogButton"), row = 0, column = 8,
sticky = "ew")
dashboard <- tcltk::ttkframe(getAmelia("gui.skel"))
yscr <- tcltk::ttkscrollbar(dashboard, orient = "vertical",
command = function(...) tcltk::tkyview(getAmelia("main.tree"),
...))
xscr <- tcltk::ttkscrollbar(dashboard, orient = "horizontal",
command = function(...) tcltk::tkxview(getAmelia("main.tree"),
...))
sorts <- rep(FALSE, times = 10)
names(sorts) <- c("#0", "transform", "lag",
"lead", "bounds",
"min", "max", "mean", "sd",
"miss")
putAmelia("sortDirs", sorts)
putAmelia("main.tree", tcltk::ttktreeview(dashboard, columns =
"transform lag lead bounds min max mean sd miss",
yscrollcommand = function(...) tcltk::tkset(yscr, ...),
xscrollcommand = function(...) tcltk::tkset(xscr, ...),
selectmode = "extended"))
tcltk::tcl(getAmelia("main.tree"), "column", "#0",
width = 70,
minwidth = 80)
tcltk::tcl(getAmelia("main.tree"), "column", 0, width = 78,
minwidth = 78, anchor = "center")
tcltk::tcl(getAmelia("main.tree"), "column", 1, width = 20,
minwidth = 20, anchor = "center")
tcltk::tcl(getAmelia("main.tree"), "column", 2, width = 20,
minwidth = 20, anchor = "center")
tcltk::tcl(getAmelia("main.tree"), "column", 3, width = 50,
minwidth = 50, anchor = "e")
tcltk::tcl(getAmelia("main.tree"), "column", 4, width = 50,
minwidth = 50, anchor = "e")
tcltk::tcl(getAmelia("main.tree"), "column", 5, width = 50,
minwidth = 50, anchor = "e")
tcltk::tcl(getAmelia("main.tree"), "column", 6, width = 50,
minwidth = 50, anchor = "e")
tcltk::tcl(getAmelia("main.tree"), "column", 7, width = 50,
minwidth = 50, anchor = "e")
tcltk::tcl(getAmelia("main.tree"), "column", 8, width = 50,
minwidth = 50, anchor = "e")
tcltk::tcl(getAmelia("main.tree"), "heading", "#0",
text = "Variable",
command = function() sortTreeBy("#0"))
tcltk::tcl(getAmelia("main.tree"), "heading", 0, text =
"Transformation",
command = function() sortTreeBy("transform"))
tcltk::tcl(getAmelia("main.tree"), "heading", 1, text =
"Lag",
command = function() sortTreeBy("lag"))
tcltk::tcl(getAmelia("main.tree"), "heading", 2, text =
"Lead",
command = function() sortTreeBy("lead"))
tcltk::tcl(getAmelia("main.tree"), "heading", 3, text =
"Bounds",
command = function() sortTreeBy("lower"))
tcltk::tcl(getAmelia("main.tree"), "heading", 4, text =
"Min",
command = function() sortTreeBy("min"))
tcltk::tcl(getAmelia("main.tree"), "heading", 5, text =
"Max",
command = function() sortTreeBy("max"))
tcltk::tcl(getAmelia("main.tree"), "heading", 6, text =
"Mean",
command = function() sortTreeBy("mean"))
tcltk::tcl(getAmelia("main.tree"), "heading", 7, text =
"SD",
command = function() sortTreeBy("sd"))
tcltk::tcl(getAmelia("main.tree"), "heading", 8, text =
"Missing",
command = function() sortTreeBy("miss"))
tcltk::tkbind(getAmelia("main.tree"), "<Button-3>",
mainTreeRightClick)
selectbg <- tcltk::tcl("ttk::style", "configure",
".", "-selectbackground")
selectfg <- tcltk::tcl("ttk::style", "configure",
".", "-selectforeground")
tcltk::tktag.configure(getAmelia("main.tree"), "normal",
background = "white")
tcltk::tktag.configure(getAmelia("main.tree"), "selected",
background = selectbg, foreground = selectfg)
tcltk::tkbind(getAmelia("main.tree"),
"<<TreeviewSelect>>",
function() refreshSelection(getAmelia("main.tree")))
putAmelia("legendFrame", tcltk::ttkframe(dashboard))
tcltk::tkgrid(tcltk::ttklabel(getAmelia("legendFrame"), text = "=
Time-Series Variable",
image = getAmelia("clockIcon"), compound = "left"), row =
0,
column = 0, sticky = "w", padx = 5)
tcltk::tkgrid(tcltk::ttklabel(getAmelia("legendFrame"), text = "=
Cross-Section Variable",
image = getAmelia("userIcon"), compound = "left"), row = 0,
column = 1, sticky = "w", padx = 5)
tcltk::tkgrid(tcltk::ttklabel(getAmelia("legendFrame"), text = "=
Unhandled Factor Variable",
image = getAmelia("redFlagIcon"), compound = "left"),
row = 0, column = 2, sticky = "w", padx = 5)
tcltk::tkgrid(getAmelia("main.tree"), row = 0, column = 0,
sticky = "news")
tcltk::tkgrid(yscr, row = 0, column = 1, sticky = "ns")
tcltk::tkgrid(xscr, row = 1, column = 0, sticky = "ew")
tcltk::tkgrid(getAmelia("legendFrame"), row = 2, column = 0,
sticky = "ew")
tcltk::tkgrid.rowconfigure(dashboard, 0, weight = 1)
tcltk::tkgrid.columnconfigure(dashboard, 0, weight = 1)
tcltk::tkadd(getAmelia("gui.skel"), toolbar)
tcltk::tkadd(getAmelia("gui.skel"), dashboard)
tcltk::tkgrid(toolbar, row = 0, column = 1, padx = 2, pady = 2,
sticky = "ew")
tcltk::tkgrid(dashboard, row = 1, column = 1, sticky = "news",
padx = 10, pady = 5)
tcltk::tkgrid.rowconfigure(getAmelia("gui.skel"), 1, weight = 1)
tcltk::tkgrid.columnconfigure(getAmelia("gui.skel"), 1, weight = 1)
tcltk::tkgrid.rowconfigure(getAmelia("gui"), 0, weight = 1)
tcltk::tkgrid.columnconfigure(getAmelia("gui"), 0, weight = 1)
putAmelia("statusbar", tcltk::ttkframe(getAmelia("gui"),
relief = "groove", borderwidth = 3))
statusbar.lab1a <- tcltk::ttklabel(getAmelia("statusbar"),
text = "Data Loaded:", anchor = "w", padding = c(2, 0))
putAmelia("statusbar.lab1b",
tcltk::ttklabel(getAmelia("statusbar"),
text = "Unspecified", relief = "sunken", anchor =
"w",
foreground = "red", padding = c(2, 0), width = 35))
statusbar.nlab <- tcltk::ttklabel(getAmelia("statusbar"),
text = "Obs:", anchor = "e", padding = c(2, 0))
putAmelia("statusbar.n",
tcltk::ttklabel(getAmelia("statusbar"),
text = "----", relief = "sunken", anchor = "w",
foreground = "red",
padding = c(2, 0, 0, 0), width = 6))
statusbar.klab <- tcltk::ttklabel(getAmelia("statusbar"),
text = "Vars:", anchor = "e", padding = c(2, 0))
putAmelia("statusbar.k",
tcltk::ttklabel(getAmelia("statusbar"),
text = "----", relief = "sunken", anchor = "w",
foreground = "red",
padding = c(2, 0, 0, 0), width = 6))
putAmelia("runAmeliaProgress",
tcltk::ttkprogressbar(getAmelia("statusbar"),
value = 0, length = 200, mode = "determinate"))
putAmelia("error.label",
tcltk::ttkbutton(getAmelia("statusbar"),
text = "Error! See Output Log.", image =
getAmelia("redStopIcon"),
compound = "left", style = "Toolbutton", command =
show.output.log))
putAmelia("allgood.label",
tcltk::ttkbutton(getAmelia("statusbar"),
text = "Successful Imputation.", image =
getAmelia("greenCheckIcon"),
compound = "left", style = "Toolbutton", command =
showImputedFiles))
putAmelia("noimps.label",
tcltk::ttklabel(getAmelia("statusbar"),
text = "No imputations run.", justify = "right"))
tcltk::tkgrid(statusbar.lab1a, row = 2, column = 1, sticky = "w")
tcltk::tkgrid(getAmelia("statusbar.lab1b"), row = 2, column = 2,
sticky = "w")
tcltk::tkgrid(statusbar.nlab, row = 2, column = 3, sticky = "w")
tcltk::tkgrid(getAmelia("statusbar.n"), row = 2, column = 4,
sticky = "w")
tcltk::tkgrid(statusbar.klab, row = 2, column = 5, sticky = "w")
tcltk::tkgrid(getAmelia("statusbar.k"), row = 2, column = 6,
sticky = "w")
tcltk::tkgrid(getAmelia("noimps.label"), row = 2, column = 7,
sticky = "e", padx = 10)
tcltk::tkgrid.rowconfigure(getAmelia("statusbar"), 2, weight = 1)
bindTooltip(widget = "output.run", tip = "Run Amelia on your input
dataset with the current settings.")
bindTooltip(widget = "runAmeliaProgress", tip = "Amelia is currently
running and this shows its progress. On large datasets, Amelia may take quite some
time.")
bindTooltip(widget = "showLogButton", tip = "Show the output log for
the Amelia run. From here, you can save the output. Look here if something went
wrong.")
bindTooltip(widget = "missmapButton", tip = "Show a map of the
missingnes in the data.")
bindTooltip(widget = "editDataButton", tip = "Edit individual cells of
the data set.")
bindTooltip(widget = "plotHistButton", tip = "Plot histogram(s) of the
selected variable(s).")
bindTooltip(widget = "loadSessionButton", tip = "Load a previously
saved Amelia session. This will remove any current settings.")
bindTooltip(widget = "saveSessionButton", tip = "Save the current
Amelia session. This will save the data, settings, and any imputed data in the Amelia
session.")
bindTooltip(widget = "legendFrame", tip = "A legend for the icons used
in the variable dashboard.")
bindTooltip(widget = "noimps.label", tip = "No imputations have been
run yet. To run Amelia, hit the 'Impute!' button in the toolbar.")
bindTooltip(widget = "allgood.label", tip = "Amelia has run
successfully! You can now run imputation diagnostics from the 'Output' menu
above. If you chose to save the imputations to file, they should be saved in the working
directory. Click here to open the containing folder..")
bindTooltip(widget = "error.label", tip = "There was an error the last
time you ran Amelia. Click here to open the output log to identify the problem and to see
how to fix it.")
if (.Platform$OS.type == "windows")
tcltk::tkwm.iconbitmap(getAmelia("gui"), file.path(find.package(package
= "Amelia")[1],
"gui/amelia.ico"))
tcltk::tkraise(getAmelia("gui"))
tcltk::tkwm.deiconify(getAmelia("gui"))
tcltk::tkfocus(getAmelia("gui"))
tcltk::tclServiceMode(on = TRUE)
tcltk::tkwait.window(getAmelia("gui"))
}
<environment: 0x7febc57b5380>
__
Miles Murphy Evers
Ph.D Student
Department of Political Science
The George Washington University
(630)-697-4344