r - write.fwf column names don't line up with values -


the following code produces table column names don't line values:

library( gdata ) test0 <- matrix(5:28, nrow = 4)  row.names(test0) <- paste("r", 1:4, sep = "") colnames(test0) <- paste("c", 1:6, sep = "")  test0[3, 2] <- 1234567890 test0[ , 3] <- 0.19412341293479123840214  test0 <- format(test0, digits = 5, trim = t, width = 10, scientific = t)  write.fwf(test0, file = paste("test", ".txt", sep = ""), width = 11, rowname = t, colname = t, quote = f)  

how can make column names line each column's values (in order have table readable gams)?

curious column names not treated in same way. work-around add column names row in table , write table without column names...

i.e.

test1 <- rbind( colnames(test0) , test0 ) write.fwf(test1, file = paste("test", ".txt", sep = ""),           width = 11,           rownames = t,           colnames = f,  #don't print column names           quote = f ) 

this looks like:

enter image description here


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -