Instead of this line:
myData <<- read.table(myval, header=TRUE, sep=",", dec = ".")
Try something like:
myData <- read.table(myval, header=TRUE, sep=",", dec = ".")
assign(tclvalue(dsName), myData, envir = .GlobalEnv)
Though you may want to make envir = .GlobalEnv
something else (if you're planning to put this on CRAN, you can't assign to the global environment in this way and instead have to use a user-created environment).
Some other notes:
- You probably want a
tkdestroy
call at the end of youronOK
function. - You might want to add a logical to check whether the user has actually supplied a name for the dataset when they press OK.