nr <- 10
nc <- 5
x <- data.frame(id=paste0("ind", 1:nr),
matrix(rnorm(nr*nc), ncol=nc))
colnames(x)[1:nc + 1] <- paste0("col", 1:nc)
testfile <- file.path(tempdir(), "tmpfile.csv")
write2csv(x, testfile, "A file created by write2csv")
# Remove the file, to clean up temporary directory
unlink(testfile)
Run the code above in your browser using DataLab