#------------------------------------------------------------------------------ # although this may give an error from edit() in qdat1() on quitting the file # it works for a quick cut and paste of a data file qdat1 <- function() { #Quick Data: part 1 of 2 # #Creates a temporary file in the current working directory #Opens an editor to paste data into #The temporary file can be read into the object 'dat' using dat <- qdat2() # file.name <- "mxyzptlk.dat" cat("*** Data stored in a temporary file in the current working directory\n*** Ready to be read with qdat2()\n*** IGNORE ANY ERROR AFTER CLOSING THE EDITOR ***\n\n") cat(file=file.name) edit(file=file.name) } qdat2 <- function(clear=TRUE, header=TRUE, sep="", na.strings=c("NA",".")) { #Quick Data: part 2 of 2 # #Reads in temporary data file created by qdat1() #Clears temporary data file as a precaution on exit by default # file.name <- "mxyzptlk.dat" dat <- read.table(file.name, header=header, sep=sep, na.strings=na.strings) if (clear) cat(file=file.name) return(dat) } #------------------------------------------------------------------------------