Description Usage Arguments Value Author(s) Examples
Pads each column to a common size so write.table() produces a fixed width format that looks nice
1 | conv.fixed.width(dat)
|
dat |
data.frame or matrix |
returns dat with space padding as character
Nicholas Cooper nick.cooper@cimr.cam.ac.uk #' @author Nicholas Cooper nick.cooper@cimr.cam.ac.uk
1 2 3 4 5 6 7 8 9 10 | orig.dir <- getwd(); setwd(tempdir()); # move to temporary dir
df <- data.frame(ID=paste("ID",99:108,sep=""),
scores=sample(150,10,TRUE)+30,age=sample(16,10,TRUE))
dff <- conv.fixed.width(df)
write.table(df,file="notFW.txt",row.names=FALSE,col.names=FALSE,quote=FALSE)
write.table(dff,file="isFW.txt",row.names=FALSE,col.names=FALSE,quote=FALSE)
cat("Fixed-width:\n",paste(readLines("isFW.txt"),"\n"),sep="")
cat("standard-format:\n",paste(readLines("notFW.txt"),"\n"),sep="")
unlink(c("isFW.txt","notFW.txt"))
setwd(orig.dir) # reset working dir to original
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.