-
Notifications
You must be signed in to change notification settings - Fork 1
/
displayInTable.R
executable file
·44 lines (41 loc) · 1.44 KB
/
displayInTable.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#' Display matrix in tcltk table
#' @usage
#' displayInTable(tclarray,title="",height=-1,width=-1,nrow=-1,ncol=-1)
#'
#' @param tclarray a dataframe
#' @param title title of the table
#' @param height -1
#' @param width -1
#' @param nrow -1
#' @param ncol -1
#'
#' @return display a Table
#' @export
#'
#' @examples
#' #data(ClinicalData)
#' \dontrun{
#' getInTable(Table= ClinicalData, title= "Clinical Data")
#' }
displayInTable <- function(tclarray,title="",height=-1,width=-1,nrow=-1,ncol=-1)
{
#require(tcltk)
tt <- tktoplevel()
tkwm.resizable(tt, TRUE, TRUE)
#tkwm.geometry(tt, "900x900")
tclRequire("Tktable")
tkwm.title(tt,title)
table1 <- tkwidget(tt,"table",rows=nrow,cols=ncol,titlerows=1,titlecols=1,
height=height+1,width=width+3,
xscrollcommand=function(...) tkset(xscr,...),yscrollcommand=function(...) tkset(yscr,...))
xscr <-tkscrollbar(tt,orient="horizontal", command=function(...)tkxview(table1,...))
yscr <- tkscrollbar(tt,command=function(...)tkyview(table1,...))
tkgrid(table1,yscr)
tkgrid.configure(yscr,sticky="nsw")
tkgrid(xscr,sticky="new")
tkconfigure(table1,variable=tclarray,background="white",selectmode="extended")
tkconfigure(table1,selectmode="extended",rowseparator="\"\n\"",colseparator="\"\t\"")
##To control whether rows and/or columns can be resized
tkconfigure(table1,resizeborders="both")
return (table1)
}