Hi all! I'm developing a shiny app and I have problems when I wanna write a .txt file.
First of all, I change the directory in order to work in a temporal one: wd <- tempdir() setwd( wd ) res.path <- paste0( wd, "/OUT/" ) dir.create( res.path ) Just before calling the function that fails, I remove, if exist, the old files of the directory: file.remove( paste0( res.path, dir( res.path ) ) ) Then, I call f.texto, whose code is as follows: f.texto <- function( l, res, a ){ myfile <- res write( paste( "SAIC50. ", a, ", ", date(), sep = "" ), file = paste( res.path, myfile, sep = "" ) ) write( "----------------------------------", file = paste (res.path, myfile, sep = ""), append = T ) write( "\r\n", file = paste( res.path, myfile, sep = "" ), append = T ) write( l[[6]], file = paste( res.path, myfile, sep = "" ), append = T ) write( "\r\n", file = paste( res.path, myfile, sep = "" ), append = T ) } and I get the next error the first time I run the app and choose the wanted option (then, the error disappears): Error in file: cannot open the connection. Warning message: In file(file, ifelse(append, "a", "w")) : cannot open the file '/tmp/RtmpSQOYnV/OUT/Resultado-ajuste5-ic50-2017-07-19.txt': No such file or director It's like the first time running the app, the file is not created with the command /write("...", file = "...") in spite of the option append is false. / Thanks for your help, Anab. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.