rtfDataFrameToTable

DESCRIPTION:

Write a dataframe to an RTF table.

USAGE:

rtfDataFrameToTable(df, rtfFile, rownames = T, colnames = T, 
  tabletitle = "Test Title", fontsize = 8, colwidth = 750, 
  tableTitleBorder = NOCELLBORDER, ...)

ARGUMENTS:

df
Dataframe to write out.
rtfFile
Full path and name of RTF file to write to.
rownames
T/F, include rownames from data frame in table
colnames
T/F, include colnames from data frame in table
tabletitle
Title of table to include in first row of table
fontsize
point size of font for table (default=8)
colwidth
column width for table columns in twips (default=750)
tableTitleBorder
border to place around table title if specified (default is NOCELLBORDER)
...
other parameters passed to rtfAddTableRow, e.g. cellBorder

DETAILS:

This function is used in to create table in RTF from a dataframe in Spotfire S+.

AUTHOR(S):

TIBCO Software Inc.

EXAMPLES:

rtfFile <- "mytest.rtf"

cat(file=rtfFile, rtfInit(bLandscape=T), append=F)

# create sample data.frame
mydf <- data.frame(myCol1=format(rnorm(10), digits=3, justify="n"), 
        myCol2=format(rnorm(10), digits=3, justify="n"), 
        myCol3=format(rnorm(10), digits=3, justify="n"), 
        myCol4=format(rnorm(10), digits=3, justify="n"), stringsAsFactors=F)

rtfDataFrameToTable(mydf, rtfFile, tabletitle="Demo of RTF Functions", 
        rownames=F, colnames=T, colwidth=1000,
        cellBorder=rep(list(rep(SOLIDCELLBORDER,4)), ncol(mydf)))

rtfSpaceBetweenTables(rtfFile, pageBreak=F)

mydf2 <- data.frame(Subject=c("Subject1", "Subject2", "Subject3"), 
        "Heart Rate"=c(90, 70, 120), 
        Weight=c(170, 200, 210), stringsAsFactors=F)

rtfDataFrameToTable(mydf2, rtfFile, tabletitle="Subject Information", 
        rownames=F, colnames=T, colwidth=1440,
        cellBorder=rep(list(rep(SOLIDCELLBORDER,4)), ncol(mydf2)))
        
rtfClose(rtfFile)