leading.blanks | R Documentation |
Add leading blanks. This is to align data in Latex tables. Changed from: cc.width <- nchar(as.character(cc)) to: cc.width <- nchar(as.character(cc),type="width") Why? To avoid problems with NA's in dataframes in txtplot. Main purpose: to align data in Latex tables. The ignore.first parameters controls the first row (often a row with names). For example:
xx <- data.frame(sample(c(1,1055500,10),10,replace=T),sample(c("a","aba","sfgsdfgfhgd"),10,replace=T))
xx.LATEX <- create.latex.table(xx)
yy <- leading.blanks(xx.LATEX,"x")
yy write.table(yy,"xx.txt",sep=" ",dimnames.write = F)
leading.blanks(xx.LATEX,"x") See example in body of function.
df |
is dataframe |
blank.char |
is the character to be added |
extra.char |
is an extra character |
min.width |
is the minimum width |
max.width |
is the maximum width |
ignore.first |
is gives special treatment to first column |
trace |
equal to TRUE produces output during execution |
A vector with the rounded numbers.
Claus E. Andersen
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.