[R] cat not evaluated before file.choose

jim holtman jholtman at gmail.com
Sun Nov 26 00:57:36 CET 2006


turn off the buffered write or use flush.console().

On 11/25/06, Kevin Middleton <kmm at mid-town.org> wrote:
> 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"
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list