print.functions {kyotil} | R Documentation |
Print Functions
Description
roundup prints a specified number of digits after decimal point even if 0s are needed at the end. formatInt prints a specified number of digits before decimal point even if 0s are needed at the beginning.
Usage
myprint(object, ...)
## Default S3 method:
myprint(..., newline = TRUE, digits = 3, print.name=TRUE)
## S3 method for class 'matrix'
myprint(object, ...)
formatInt(x, digits, fill = "0", ...)
make.latex.coef.table(models, model.names = NULL, row.major = FALSE, round.digits = NULL)
mysanitize.text(str)
mysanitize.numbers(x)
mytex(dat = NULL, file.name = "temp", digits = NULL, display
= NULL, align = "r", include.rownames = TRUE,
include.colnames = TRUE, col.headers = NULL, comment =
FALSE, floating = FALSE, lines = TRUE, hline.after =
NULL, add.to.row = NULL, sanitize.text.function =
NULL, append = FALSE, preamble = "", input.foldername
= NULL, save2input.only = NULL, caption = NULL, label
= paste("tab", last(strsplit(file.name, "/")[[1]]),
sep = " "), table.placement = "h!",
add.clear.page.between.tables = FALSE, longtable =
FALSE, verbose = FALSE, silent = TRUE, ...)
mytex.begin(file.name, preamble = "")
mytex.end(file.name)
mywrite(x, ...)
mywrite.csv(x, file = "tmp", row.names = FALSE, digits = NULL,
silent = TRUE, ...)
roundup (value, digits, na.to.empty=TRUE, remove.leading0=TRUE)
formatDouble(value, digits, na.to.empty=TRUE, remove.leading0=TRUE)
Arguments
silent |
tbdnewline |
input.foldername |
tbdnewline |
object |
tbdnewline |
newline |
tbdnewline |
print.name |
tbddigits |
save2input.only |
Boolean |
include.colnames |
Boolean |
col.headers |
string. Column headers |
comment |
Boolean, whether to include the version and timestamp comment |
hline.after |
vector |
add.to.row |
a list |
sanitize.text.function |
a function |
str |
tbdvalue |
remove.leading0 |
tbdvalue |
caption |
tbdvalue |
longtable |
tbdvalue |
label |
default to be the same as file.name stem |
table.placement |
tbdvalue |
na.to.empty |
tbdvalue |
value |
tbdvalue |
digits |
tbddigits |
fill |
tbdfill |
models |
tbdmodels |
model.names |
tbdmodel.names |
row.major |
tbdrow.major |
round.digits |
tbdround.digits |
dat |
tbddat |
file.name |
tbdfile.name |
display |
tbddisplay |
align |
tbdalign |
append |
tbdappend |
preamble |
tbdpreamble |
include.rownames |
tbdinclude.rownames |
floating |
tbdfloating |
lines |
tbdlines |
... |
tbd... |
verbose |
tbd... |
x |
tbdx |
file |
tbdfile |
row.names |
tbdrow.names |
add.clear.page.between.tables |
tbdrow.names |
Examples
roundup (3.1, 2) # 3.10
formatInt(3, 2) # 03
## Not run:
# demo of dimnames
tab=diag(1:4); rownames(tab)<-colnames(tab)<-1:4; names(dimnames(tab))=c("age","height")
# for greek letter in the labels, we need sanitize.text.function=identity
rownames(tab)[1]="$\alpha$"
# note that to use caption, floating needs to be TRUE
mytex (tab, file="tmp1", sanitize.text.function=identity,
caption="This is a caption .........................", caption.placement="top",
floating=TRUE)
# col.headers has to have the RIGHT number of columns
# but align is more flexible, may not need to include the rownames col
tab=diag(1:4); rownames(tab)<-colnames(tab)<-1:4
mytex (tab, file="tmp", include.rownames = TRUE,
align=c("c","c","c|","c","c"), col.headers=
"\hline\n & \multicolumn{2}{c|}{Vaccine} & \multicolumn{2}{c}{Control} \\ \n")
# not include rownames
mytex (tab, file="tmp", include.rownames = FALSE,
align=c("c","c","c|","c","c"), col.headers=
"\hline\n \multicolumn{2}{c|}{Vaccine} & \multicolumn{2}{c}{Control} \\ \n")
# It should work even if some rownames are duplicated
tab=diag(1:4); rownames(tab)=rep(1,4); colnames(tab)<-1:4
mytex (tab, file="tmp", include.rownames = TRUE,
align=c("c","c|","c","c"), col.headers=
"\hline\n & \multicolumn{2}{c|}{Vaccine} & \multicolumn{2}{c}{Control} \\ \n")
# add.to.rows
tab=diag(1:4); rownames(tab)<-1:4; colnames(tab)<-c("a","b","c","d")
mytex (tab, file="tmp",
add.to.row=list( list(0,2),
c(" \multicolumn{5}{l}{Heading 1} \\ \n",
"\hline\n \multicolumn{5}{l}{Heading 2}\\ \n"
))
)
## End(Not run)
[Package kyotil version 2024.5-8 Index]