The TableCells class contains all of the TableCell objects that comprise a table.
Object of R6Class
with properties and methods relating
to the cells of a table.
R6Class
object.
parentTable
Owning table.
rows
The rows of cells in the table.
For more complete explanations and examples please see the extensive vignettes supplied with this package.
new(...)
Create a new set of table cells, specifying the field values documented above.
reset())
Clears and removes all of the cells.
getCell(r, c))
Get the TableCell at the specified row and column coordinates in the table.
getValue(r, c))
Get the value at the specified row and column coordinates in the table.
getRowValues(rowNumber=NULL, columnNumbers=NULL,
formattedValue=FALSE, asList=FALSE, rebase=TRUE)
Get a vector or list of the values in a row.
getColumnValues(columnNumber=NULL, rowNumbers=NULL,
formattedValue=FALSE, asList=FALSE, rebase=TRUE)
Get a vector or list of the values in a column.
setCell(r, c, cellType="cell", rawValue=NULL,
formattedValue=NULL, visible=TRUE, baseStyleName=NULL,
styleDeclarations=NULL, rowSpan=NULL, colSpan=NULL)
Set the details of a cell in the table.
setBlankCell(r, c, cellType="cell", visible=TRUE,
baseStyleName=NULL, styleDeclarations=NULL, rowSpan=NULL,
colSpan=NULL)
Set a cell to be empty in the table.
deleteCell(r, c)
Remove a cell from the table (replacing it with a blank one).
setValue(r, c, rawValue=NULL, formattedValue=NULL)
Set the value of a cell.
setRow(rowNumber=NULL, startAtColumnNumber=1, cellTypes=NULL,
rawValues=NULL, formattedValues=NULL, formats=NULL, visiblity=TRUE,
baseStyleNames=NULL)
Set multiple cells across a row at once.
setColumn(columnNumber=NULL, startAtRowNumber=1,
cellTypes=NULL, rawValues=NULL, formattedValues=NULL, formats=NULL,
visiblity=TRUE, baseStyleNames=NULL)
Set multiple cells down a column at once.
extendCells(rowCount=NULL, columnCount=NULL)
.
moveCell(r, c, cell))
Move the cell to the specified row and column coordinates in the table.
insertRow(rowNumber, insertBlankCells=TRUE, headerCells=1,
totalCells=0)
Insert a new row (moving the rows underneath down), where headerCells and totalCells control default styling.
deleteRow(rowNumber=NULL)
Delete a row (moving the rows underneath up.
insertColumn(columnNumber, insertBlankCells=TRUE,
headerCells=1, totalCells=0)
Insert a new column (moving other columns rightwards, where headerCells and totalCells control default styling.
deleteColumn(columnNumber=NULL)
Delete a column (moving other columns leftwards.
getCells(specifyCellsAsList=FALSE, rowNumbers=NULL,
columnNumbers=NULL, cellCoordinates=NULL)
Retrieve cells by a combination of row and/or column numbers.
findCells(rowNumbers=NULL, columnNumbers=NULL, minValue=NULL,
maxValue=NULL, exactValues=NULL, includeNull=TRUE, includeNA=TRUE)
Find cells matching the specified criteria.
getColumnWidths())
Retrieve the width of the longest value (in characters) in each column.
asList())
Get a list representation of the table cells.
asJSON()
Get a JSON representation of the table cells.
# NOT RUN {
# This class should only be created by the table.
# It is not intended to be created outside of the table.
library(basictabler)
tbl <- qtbl(data.frame(a=1:2, b=3:4))
cells <- tbl$cells
cells$setCell(r=4, c=1, cellType="cell", rawValue=5)
cells$setCell(r=4, c=2, cellType="cell", rawValue=6)
tbl$renderTable()
# }
Run the code above in your browser using DataLab