[R] cat not evaluated before file.choose
Kevin Middleton
kmm at mid-town.org
Sun Nov 26 00:42:51 CET 2006
As part of a larger function I have code similar to the reduced
example below. The user is instructed to choose a file, which gets
read using read.csv. In this example, I just have the name of the
file print out.
When I call this function with choosefile(), the file dialog box
appears before the first cat line is printed. After I choose a file,
both cat lines are printed.
choosefile <- function (){
cat("Choose the data file.\n")
filename <- file.choose(new = FALSE)
cat("You chose: ", filename, sep = "")
}
Is there a way to force the first cat line to print before the call
to file.choose? I'm using R 2.4.0 Patched (2006-11-24 r39989) on OS
X. Session info below.
Any suggestions would be greatly appreciated.
Kevin Middleton
-------
> sessionInfo()
R version 2.4.0 Patched (2006-11-24 r39989)
powerpc-apple-darwin8.8.0
locale:
en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] "stats" "graphics" "grDevices" "utils" "datasets"
"methods" "base"
More information about the R-help
mailing list