visielse {ViSiElse} | R Documentation |
Function visielse
Description
visielse
plots the graphic from time data and build an object class
ViSigrid
with, at least, the time data of each punctual action defined
in the ViSibook
for all subjects.
Usage
visielse(X, book = NULL, is.ViSibook = FALSE, doplot = TRUE,
Xsup = NULL, method = "global", group = NULL, grwithin = NULL,
informer = "median", tests = TRUE, threshold.test = 0.01,
quantity = "N", pixel = 20, t_0 = 0, sorted.line = TRUE,
decrgr2 = FALSE, max_tps = NULL, colvect = NULL, ncolvect = NULL,
times = FALSE, timeformat = c("hh:mm:ss"), idsubject = 1)
Arguments
X |
A |
book |
A
|
is.ViSibook |
A logical
|
doplot |
A logical If |
Xsup |
A |
method |
In { |
group |
A |
grwithin |
A level of |
informer |
In { " |
tests |
A boolean.
When |
threshold.test |
A numeric between 0 and 1.
|
quantity |
In { " |
pixel |
An integer. It is the number of unit of time under which individuals are aggregated in the plot. |
t_0 |
either 0, either a value of the slot " |
sorted.line |
A boolean.
When |
decrgr2 |
A boolean. When sorted.line is TRUE and decrgr2 is TRUE, long actions of the second group are plotted in decreasing order by starting times. |
max_tps |
A numeric, |
colvect |
A |
ncolvect |
A |
times |
A boolean. If |
timeformat |
time format. If |
idsubject |
An integer between 1 and |
Details
-
method
-
global
: The plot of the ViSigrid object will not consider the parametergroup
and plot indistinctly all individuals. -
cut
: In the plot of the ViSigrid object, each group will be plotted separately, one under the other with different colors. -
join
: In the plot of the ViSigrid object, groups are spatially mixed but they are represented by different colors. within
: In the plot of the ViSigrid object, all individuals are plotted together then the group specified ingrwithin
is plotted another time underneath.
-
-
informer
The parameter
informer
allows users to choose the statistics to be plotted.informer
can take three values:-
median
: Median and quartiles are calculated for each action, using the function quantile from the package stats. This is the default value. mean
: Mean and standard deviation are calculated for each action, using the functions mean and var from the package stats.NULL
: no indicators are computed.
When a group is defined, statistics are calculated per group if the method cut or within is chosen.
When plotting the
ViSigrid
object, statistics for punctual actions are represented by white circles linked by a line. For long action, only a black line is plotted starting at the median (or mean) value of the punctual action staring times. The line length represents the median (or mean) of the long action duration. Informers are computed directly on the given matrix for punctual action. And for long actions, it is based on the difference between the punctual action defining its beginning and the one defining its ending. -
-
tests
andthreshold.test
As for the parameter informer, tests are computed on the given matrix or data.frame X for a punctual action. And for a long action, it is calculated on its difference between its beginning and its ending punctual actions. In
plot-ViSigrid-method
, results of the tests are represented by a star only when the resulted p-value is bellow or equal to value defined by the parameter threshold.test. -
pixel
The parameter pixel represents the number of unit of time under which individuals are aggregated for punctual action in the plot. When the parameter pixel is too small the information represented will be too much aggregated to allow interpretation.
For punctual actions data are aggregated in a matrix
M
. The number of row ofM
is the number of action and its number of columns is[ ( max(X)-t_{0} )/pixel]
.M_{i,j}
contains the number of observations of thei
-th punctual action (by the order of the ViSibook object) betweent_0 + (j-1)pixel
included andt_0 + j*pixel
excluded. -
t_0
The origin of the graphic can be set using the parameter t_0. There is two ways to define it:
A number: set to 0__. It can be change at convenience, but for long actions black zones will not be drawn, and for punctual actions black and green zones will not be translated.
The name of a punctual action: To set the origin of the graphic to the moment when the action was done for each individual. Black and green zones will not be translated as well.
x can also has the columns : GZDebn, GZFin, Repetition, BZBeforeDeb, BZBeforeFin, BZAfterDeb, BZAfterFin, BZLong , BZLtype
Value
a ViSigrid object.
See Also
Classes ViSigrid
and ViSibook
.
The method plot for ViSigrid object plot-ViSigrid-method
for examples.
Examples
coffee <- c( 58, 11, 5, 53, 53, 59, 24, 59, 46, 20)
fill_coffee <- c(162, 57,103,154,165,132, 74, 107, 104, 93)
fill_water <- c( 66, 92,54, 78, 74, 114, 91, 129, 71, 56)
push_B <- c( 74, 99, 62, 84, 83, 120, 95, 129, 80, 63 )
drink <- c( 472, 176, 475, 283, 265, 207, 234, 184, 490, 520)
X <- data.frame(id = seq(1,10), coffee, fill_coffee,fill_water,push_B,drink)
library(ViSiElse)
visi1 <- visielse(X)
#### Changing the pixel of time
visi1 <- visielse(X, pixel = 10)
# Plot the mean and standart deviation
visi1 <- visielse(X,informer = "mean")
#### Do not plot indicators
visi1 <- visielse(X,informer = NULL)
# Extraction of the visibook from the data
visi1 <- visielse(X,informer = NULL, doplot = FALSE)
book <- visi1@book
plot(book)
#### Changing labels
book[,2]<- c("Taking the coffee",
"Fill the machine with coffee",
"Fill the tank with water",
"Push the Button",
"Drink the coffee")
plot(book)
visi1 <- visielse(X, book=book, is.ViSibook = TRUE,informer = NULL)
#### Change the order of Actions in the process
book[,4]<- c(5,1,2,4,3)
plot(book)
visi1 <- visielse(X, book=book, is.ViSibook = TRUE)
#### Adding a long Actions
visi1 <- visielse( X )
book <- ConvertFromViSibook( visi1@book ) # Convert book into data.frame
add_delay <- c( "delay_coffee_push","Preparation","l","6","coffee","push_B")
book[6,] <- add_delay
book
### ViSiElse representation of long actions
visi2 <- visielse( X=X , book=book,informer=NULL)
## Green & Black zones
book$GZDeb <- c(NA,60,NA,NA,NA,NA)
book$GZFin <- c(NA,120,NA,NA,NA,NA)
book$BZBeforeDeb <- c(NA,0,NA,NA,NA,NA)
book$BZBeforeFin <- c(NA,30,NA,NA,NA,NA)
book$BZAfterDeb <- c(NA,180,NA,NA,NA,NA)
book$BZAfterFin <- c(NA,Inf,NA,NA,NA,NA)
book$BZLong <- c(rep(NA,5),150)
book$BZLtype <- c(rep(NA,5),"time")
visi1 <- visielse( X, book=book , informer = NULL)
book$BZLtype <- c(rep(NA,5),"span")
visi1 <- visielse( X, book=book ,informer = NULL)
## Group
### Method : Cut
group <- c( "group2","group1","group2","group1","group1",
"group2","group1","group1","group1","group2")
visi1 <- visielse( X,group=group, book=book ,informer = NULL, method = "cut")
visi1 <- visielse( X,group=group, book=book ,informer = NULL, method = "join")
visi1 <- visielse( X,group=group, book=book ,informer = NULL, method = "within",grwithin = "group1")