Title: | 'ade4' Tcl/Tk Graphical User Interface |
---|---|
Description: | A Tcl/Tk GUI for some basic functions in the 'ade4' package. |
Authors: | Jean Thioulouse [aut] , Stéphane Dray [aut] , Aurélie Siberchicot [aut, cre] |
Maintainer: | Aurélie Siberchicot <[email protected]> |
License: | GPL (>=2) |
Version: | 0.3-1 |
Built: | 2024-11-16 05:20:24 UTC |
Source: | https://github.com/adeverse/ade4tkgui |
A Tcl/Tk GUI for some basic functions in the ade4
package.
ade4TkGUI(show = FALSE, history = FALSE)
ade4TkGUI(show = FALSE, history = FALSE)
show |
a logical value. If |
history |
a logical value. If |
Right-click on ade4
function buttons to get help on these functions.
You can also click on the questionhead icon in the dialog windows.
This displays the R
help for the corresponding function.
In all dialog windows, entries can either be filled with a Set
button, or typed
directly in the entry field. The Set
button displays a listbox with a list
of available objects in the global environment. This list is restricted to objects
with an adequate type (dataframe, dudi
, factor, etc). Entries can also be filled
directly by typing the desired value. In this case, R
expressions can also be entered,
for example c("red", "green", "blue")
, doubs$mil[1:20,1:5]
, meau$plan$dat
, or 1:20
.
The first row of buttons (- Data sets -
) is used to load data sets,
either from a tab-delimited text file exported from Excel (Read data file
button), or from the ade4
package built-in datasets (Load a data set
button;
right-click to get help on the selected dataset).
The second block of buttons (- One table analyses -
) gives access to simple analyses
(like pca
), in which only one table is analysed.
The third block (- One table with groups -
) is for analyses in which the
rows of the table belong to several groups. This is the case for example for
discriminant analysis (discrimin
) and for the within
and between
analyses (see ade4
documentation).
The fourth block (- Two tables analyses -
) gives access to three analyses
in which the relationships between two data tables are analysed. cca
is the well
known (at least in ecology) canonical correspondence analysis, coinertia
can be seen
as a robust alternative to cca
when the number of samples is low, and pcaiv
is principal components analyses with respect to instrumental variables (see ade4
documentation).
The fifth block (- Graphic functions -
) contains three buttons that
launch the dialog windows for three basic graphic functions in ade4
: s.label
(scatter diagram of a factor map), s.class
(scatter diagram with groups),
s.value
(scatter diagram with squares proportional to one variable).
Other graphic functions are available in the Graphics
menu : s.arrow
(scatter diagram with arrows),
s.corcircle
(correlation circle in normed pca), s.class
(scatter diagram with convex hulls, using the
chullSize
argument), and s.match
(scatter diagram of two paired clouds of points).
The sixth block (- Advanced graphics -
) can be used for several things:
- dudi display
displays a dialog window grouping all the components of a dudi
.
Each of these components is represented by a button which action is to draw a graphical
display of the corresponding component. The axes used to draw theses graphics can be set
by the user. The last row of buttons gives access to particular graphic functions that
can be used according to the dudi
type.
- MCTests
displays a dialog window for computing Monte-Carlo tests
after (e.g.) a between
or coinertia
analysis.
- ordiClust
displays a dialog window for analysing cluster on ordination scores,
providing a dynamic exploration of the clusters on the factor maps.
The menu bar at the top of the window can be used to launch the same functions, plus several others. All theses menus are tear-off.
The File
menu can be used to read and load files and datasets, to edit a dataframe,
and to quit R :
- Read text file
allows to read a data file and store the result in a dataframe.
It can be used to read standard Excel tab-delimited text files (with variable names on the
first row and sample names in the first column, leaving the first cell empty).
The name "clipboard" can be used to read a data table just copied from an Excel data sheet
(so it is not necessary to save the data in a text file).
- Load data set
allows to load a data set from the ade4
package.
- Edit data frame
can be used to edit a dataframe.
- Quit R
opens a dialog window to ask if the environment should be saved before
quitting R.
The Windows
menu allows to manage several graphical windows :
- New graphic window
opens a new graphic window and makes it the active window.
This is usefull to compare easily several graphics.
- Change graphic window
changes the active window (i.e., the one into
which the next graphic will be drawn).
- Save graphic window
saves the graphic drawn in the active window into
a disk file in several formats (postscript, pdf, etc).
The 1table
, 1table+groups
, 2tables
, and Graphics
menus give access to several other analysis methods and graphics.
If the show
argument is set to TRUE, then all the commands executed in the GUI are echoed
to the console. This is handy for complex commands, as it allows to check the exact syntax of the
command that was executed.
If the history
argument is set to TRUE, then the commands executed in the GUI (the same as
the commands which are echoed to the console) are stored in the R session history buffer. For each
command, the history buffer is written to a temporary disk file with savehistory()
, the
command is appended to this file, and the file is reread in memory with loadhistory()
.
The value (TRUE
or FALSE
) of both arguments is recalled in the title of the window (ade4TkGUI), so that
different instances of the GUI launched simultaneously with different values for these arguments
can be easily recognized.
Jean Thioulouse [email protected]
Stephane Dray [email protected]
## Not run: ## Start the GUI ade4TkGUI() ## End(Not run)
## Not run: ## Start the GUI ade4TkGUI() ## End(Not run)
Internal functions for the ade4TkGUI package
These are not to be called by the user.
This function does cluster analysis on ordination scores, providing a dynamic exploration
of the clusters on the factor maps. As a first step, an ordination method computes the row scores
of the input data table. In a second step, cluster analysis is used on these row scores to obtain
groups. The dudi and the factor are available in the global environment under the names
ordiClust.dudi
and ordiClust.factor
.
ordiClust(datatab=NULL, hscalef=1.2, vscalef=1.2, maxgr=20)
ordiClust(datatab=NULL, hscalef=1.2, vscalef=1.2, maxgr=20)
datatab |
a dataframe containing the data table to analyse, or directly a dudi. |
hscalef |
horizontal scale factor used to resize the drawing in the tkrplot window. |
vscalef |
vertical scale factor used to resize the drawing in the tkrplot window. |
maxgr |
maximum number of groups displayed on the ordination factor map. |
The GUI is divided in a graph panel on the right and several dialog panels on the left.
Under the graph panel, a scale widget can be used to set the number of groups, and
three buttons allow to change the graphical parameters (ellipses or convex hulls,
and color or black & white). The Submit
button under the graph (or the return key)
draws the groups on the factor map. Up arrow
and Down arrow
keys (or the scale
widget) can be used to increase or decrease the number of groups. Choosing another clustering
algorithm or another distance automatically updates the graph, allowing easy comparisons. The
Dismiss
button at the bottom of the window closes the ordiClust window, and the Save
button can be used to save the current graphic in a disk file.
From top to bottom the left panels are :Input data frame
: this is the data table that will be analysed. The user can set it
with the Set
button.Input dudi
: this is directly the dudi that will be analysed. The user can set it
with the Set
button. No ordination method should be used when a dudi is selected here:
cluster analysis will be done on the row scores of this dudi.Ordination method
: the user can choose between principal component analysis (centered
or normed), correspondence analysis, and multiple correspondence analysis. After computations
are finished, the eigenvalues bar chart is displayed in the right panel. The user can then
set the number of principal components (axes) on which cluster analysis will be done
with the Set
button (defaults to 2). If no number is chosen, then all axes are kept.Ordination graph
: draw the factor maps for rows or columns. Axis numbers can be
chosen (default is 1 for X axis and 2 for Y axis).Cluster analysis - Distance
: choose the way distances are computed among rows. See help("dist").
The dudi
option is a special case: computations are done with the dist.dudi
function of the
ade4
package (i.e., for a normed PCA this is the Euclidean distance computed on normed variables).Cluster analysis - Cluster method
: choose the clustering algorithm. See help("hclust").
The Submit
button starts the computations and the hierarchical tree is displayed in the
right panel. Choosing another algorithm or another distance automatically updates the graph,
allowing easy comparisons.Number of groups
: this is the number of groups used to cut the tree computed by cluster analysis.
The Cut tree
button cuts the tree and draws a red line on the right panel. Up arrow
and Down arrow
keyboard keys (or the scale widget) can be used to increase or decrease
this value respectively.Level height
: height of the cut level in the tree computed by cluster analysis.
The Cut tree
button cuts the tree and draws a red line on the right panel.Inertia ratio
: this is the between group to total inertia ratio (percentage of explained variance).
The Draw curve
button draws the curve of this ratio as a function of the number
of groups. Steps on this curve can be used to choose the number of groups. The red cross
on this graph gives the number of groups and the corresponding percentage of between-groups
inertia. Up arrow
and Down arrow
keys (or the scale widget) can be used to increase or
decrease the number of groups. Choosing another clustering algorithm or another distance
automatically updates the graph, allowing easy comparisons.BGA MCTest p-value
: p-value of the Between Groups Analysis Monte-Carlo test (BGA, ade4
between
function).
The dudi and the factor used to draw the graphs are available in the global environment,
withe the names ordiClust.dudi
and ordiClust.factor
.
Jean Thioulouse [email protected]
Stephane Dray [email protected]
## Not run: ## Start the GUI form the console data(meau) ordiClust(dudi.pca(meau$mil,scan=F)) ## End(Not run)
## Not run: ## Start the GUI form the console data(meau) ordiClust(dudi.pca(meau$mil,scan=F)) ## End(Not run)