Version: | 0.9.5 |
Date: | 2024-07-23 |
Title: | Functions to Calculate Common Laterality Statistics in Primatology |
Author: | Borel A., Pouydebat E., Reghem E. |
Maintainer: | Antony Borel <antony.borel@gmail.com> |
Description: | Calculates and plots Handedness index (HI), absolute HI, mean HI and z-score which are commonly used indexes for the study of hand preference (laterality) in non-human primates. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2.0)] |
LazyData: | yes |
Imports: | ade4 |
NeedsCompilation: | no |
Packaged: | 2024-07-23 15:36:59 UTC; Antony |
Repository: | CRAN |
Date/Publication: | 2024-07-23 16:50:01 UTC |
Laterality
Description
Calculates handedness index (HI) and z-score for each individual and each task performed. It plots barplots of the different type of grasp (Left, right, bimanual...) for each kind of activity. It plots also the Handedness Index of each individual for each activity. The mean Handedness Index and the absolute HI and absolute mean HI can be calculated. Finally some functions (based on ade4-package functions) calculates disjunctive table, Burt table and contributions for MCA and then plots multiple correspondence analysis graphs.
Details
This package is particularly useful to calculate and plot the different indexes (HI, z-score, mean HI, absolute HI) commonly used in hand preference studies of non-human primates.
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com>
References
Chessel D., Dufour A.-B. and Dray S., with contributions from Jombart T., Lobry J.R., Ollier S., Pavoine S. and Thioulouse J. Package ade4: Analysis of Ecological Data : Exploratory and Euclidean methods in Environmental sciences.
Hopkins W.D.(1999) On the Other Hand: Statistical Issues in the Assessment and Interpretation of Hand Preference Data in Nonhuman Primates. International Journal of Primatology 20(6):851-866.
See Also
ade4
the multiple correspondence analysis functions are based on ade4 package.
Examples
### later function ###
## With arguments corresponding to the default ones:
data(laterdata)
str(laterdata)
Data<-laterdata
later(Data, catch ="Food", indiv="Indiv", hand="Hand",
RightHand="R", LeftHand="L", savetable = FALSE)
## or
later(Data)
## With arguments different from the default ones:
data(lateradata)
str(lateradata)
Data<-lateradata
later(Data, catch ="Act", indiv="Individual", hand="HandPref",
RightHand="Right", LeftHand="Left", savetable = FALSE)
### HIndiv function ###
## With arguments corresponding to the default ones:
str(laterdata)
Data<-laterdata
HIndiv(Data, catch="Food", hand="Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", legendlocation=FALSE, legend.text=TRUE)
## or
HIndiv(Data, legendlocation=FALSE, legend.text=TRUE)
## With arguments different from the default ones:
str(lateradata)
Data<-lateradata
HIndiv(Data, catch="Act", hand="HandPref", indiv = "Individual",
RightHand = "Right", LeftHand = "Left", legendlocation=FALSE, legend.text=TRUE)
### HImeanact function ###
## With arguments corresponding to the default ones:
str(laterdata)
Data<-laterdata
HImeanact(Data, catch="Food", hand="Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L")
## or
HImeanact(Data)
## With arguments different from the default ones:
str(lateradata)
Data<-lateradata
HImeanact(Data, catch="Act", hand="HandPref", indiv = "Individual",
RightHand = "Right", LeftHand = "Left")
HImeanact: this function calculates the mean Handedness Index for each activity.
Description
Calculates the mean Handedness Index for each task performed and plots the corresponding histogram. The results can be saved in a .csv file.
Usage
HImeanact(data, catch = "Food", hand = "Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", col = 2:((length(levels
(data[[catch]]))) + 1), ylab = "Mean handedness index",
main = "Hand preference regarding to the performed task",
legend.text = FALSE, beside = TRUE, ylim = c(-1, 1), names.arg=levels(data[[catch]]),
legendlocation = FALSE, standarderror=TRUE, cex = 1, pt.cex = 2, pch = 15,
horiz = FALSE, savetable = FALSE, file = "HImeanPerAct.csv")
Arguments
data |
The object (data.frame) containing your data with at least the qualitative variables concerning the hand used (hand), the individuals (indiv) and the activity performed (catch). |
catch |
The name/header of the column concerning the activity carried out (by default "Food"), if you made individuals catching different objects (ob1, ob2, ob3, ob4) and named the variale "ObjectCatched", write catch = "ObjectCatched". |
hand |
The name/header of the column concerning the hand used (by default "Hand"). |
indiv |
The name/header of the column concerning the individuals (by default "Indiv"). |
RightHand |
The code used in the database (and particularly in the "hand" variable) for "RightHand". If "RightHand" is coded as "Right" write RightHand = "Right" (by default "R"). |
LeftHand |
The code used in the database (and particularly in the "hand" variable) for "LeftHand". If "LeftHand" is coded as "Left" write LeftHand = "Left" (by default "L"). |
col |
A list of color for the bars of the histogram. By default it will automatically find the number of colors you need but it's using the 8 colors of the default palette of R. If you need more don't forget to select another palette or to name the color you want to add. |
ylab |
A title for the y axis. |
main |
The main title of the graph. |
legend.text |
If legend.text = TRUE, the legend will be automatically placed on the graph. If legend.text = FALSE, no legend will appear except if legendlocation = TRUE. |
beside |
If FALSE, the columns of height are portrayed as stacked bars, and if TRUE the columns are portrayed as juxtaposed bars. |
ylim |
The minimum and maximum value of the y axis. For example ylim = c(0,500). By default (ylim = NULL) the values are automatically selected. |
names.arg |
Plot the name of the arguments under each bar of the barplot. If names.args=FALSE, one should choose to turn to TRUE legend.text or legendlocation. |
legendlocation |
If TRUE you will have to click where you want to place the legend after the plot is done. |
standarderror |
If standarderror=TRUE standard error bars will be plotted for each bar of the barplot. |
cex |
A numeric giving the size of the legend characters. |
pt.cex |
A numeric giving the size of the legend points. |
pch |
This can either be a single character or an integer code for one of a set of graphics symbols. This will be applied to the legend. (By default pch = 15 which is square). |
horiz |
If horiz = TRUE, the legend will be displayed horizontally (by default). If horiz = FALSE, the legend will be displayed vertically. |
savetable |
This arguments permits to save directly the results of the function in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
file |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "HImeanPerAct.csv") |
Details
The mean HI is calculated from the HI of each task performes by each individual.
Value
The function returns results of class "data.frame".
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com>
Examples
## With arguments corresponding to the default ones:
data(laterdata)
str(laterdata)
Data<-laterdata
HImeanact(Data, catch="Food", hand="Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", legendlocation=FALSE)
## or
HImeanact(Data)
## With arguments different from the default ones:
data(lateradata)
str(lateradata)
Data<-lateradata
HImeanact(Data, catch="Act", hand="HandPref", indiv = "Individual",
RightHand = "Right", LeftHand = "Left")
HImeanactabs: this function calculates the absolute mean Handedness Index for each activity.
Description
Calculates the absolute mean Handedness Index for each task performed and plots the corresponding histogram. The results can be saved in a .csv file.
Usage
HImeanactabs(data, catch = "Food", hand = "Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", col = 2:((length(levels
(data[[catch]]))) + 1), ylab = "Mean handedness index",
main = "Hand preference regarding to the performed task",
legend.text = FALSE, beside = TRUE, ylim = c(-1, 1), names.arg=levels(data[[catch]]),
legendlocation = FALSE, standarderror=TRUE, cex = 1, pt.cex = 2, pch = 15,
horiz = FALSE, savetable = FALSE, file = "HImeanPerActabs.csv")
Arguments
data |
The object (data.frame) containing your data with at least the qualitative variables concerning the hand used (hand), the individuals (indiv) and the activity performed (catch). |
catch |
The name/header of the column concerning the activity carried out (by default "Food"), if you made individuals catching different objects (ob1, ob2, ob3, ob4) and named the variale "ObjectCatched", write catch = "ObjectCatched". |
hand |
The name/header of the column concerning the hand used (by default "Hand"). |
indiv |
The name/header of the column concerning the individuals (by default "Indiv"). |
RightHand |
The code used in the database (and particularly in the "hand" variable) for "RightHand". If "RightHand" is coded as "Right" write RightHand = "Right" (by default "R"). |
LeftHand |
The code used in the database (and particularly in the "hand" variable) for "LeftHand". If "LeftHand" is coded as "Left" write LeftHand = "Left" (by default "L"). |
col |
A list of color for the bars of the histogram. By default it will automatically find the number of colors you need but it's using the 8 colors of the default palette of R. If you need more don't forget to select another palette or to name the color you want to add. |
ylab |
A title for the y axis. |
main |
The main title of the graph. |
legend.text |
If legend.text = TRUE, the legend will be automatically placed on the graph. If legend.text = FALSE, no legend will appear except if legendlocation = TRUE. |
beside |
If FALSE, the columns of height are portrayed as stacked bars, and if TRUE the columns are portrayed as juxtaposed bars. |
ylim |
The minimum and maximum value of the y axis. For example ylim = c(0,500). By default (ylim = NULL) the values are automatically selected. |
names.arg |
Plot the name of the arguments under each bar of the barplot. If names.args=FALSE, one should choose to turn to TRUE legend.text or legendlocation. |
legendlocation |
If TRUE you will have to click where you want to place the legend after the plot is done. |
standarderror |
If standarderror=TRUE standard error bars will be plotted for each bar of the barplot. |
cex |
A numeric giving the size of the legend characters. |
pt.cex |
A numeric giving the size of the legend points. |
pch |
This can either be a single character or an integer code for one of a set of graphics symbols. This will be applied to the legend. (By default pch = 15 which is square). |
horiz |
If horiz = TRUE, the legend will be displayed horizontally (by default). If horiz = FALSE, the legend will be displayed vertically. |
savetable |
This arguments permits to save directly the results of the function in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
file |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "HImeanPerActabs.csv") |
Value
The function returns results of class "data.frame".
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com>
Examples
## With arguments corresponding to the default ones:
data(laterdata)
str(laterdata)
Data<-laterdata
HImeanactabs(Data, catch="Food", hand="Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L")
## or
HImeanactabs(Data)
## With arguments different from the default ones:
data(lateradata)
str(lateradata)
Data<-lateradata
HImeanactabs(Data, catch="Act", hand="HandPref", indiv = "Individual",
RightHand = "Right", LeftHand = "Left")
HImeanind: this function calculates the mean Handedness Index of each individual.
Description
Calculates the mean Handedness Index of each individual and plots the corresponding histogram. The results can be saved in a .csv file.
Usage
HImeanind(data, catch = "Food", hand = "Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", col = 2:((length(levels
(data[[indiv]]))) + 1), ylab = "Mean handedness index",
main = "Hand preference regarding to the individuals",
legend.text = FALSE, beside = TRUE, ylim = c(-1, 1), names.arg=levels(data[[indiv]]),
legendlocation = FALSE, standarderror=TRUE, cex = 1, pt.cex = 2, pch = 15,
horiz = FALSE, savetable = FALSE, file = "HImeanPerIndiv.csv")
Arguments
data |
The object (data.frame) containing your data with at least the qualitative variables concerning the hand used (hand), the individuals (indiv) and the activity performed (catch). |
catch |
The name/header of the column concerning the activity carried out (by default "Food"), if you made individuals catching different objects (ob1, ob2, ob3, ob4) and named the variale "ObjectCatched", write catch = "ObjectCatched". |
hand |
The name/header of the column concerning the hand used (by default "Hand"). |
indiv |
The name/header of the column concerning the individuals (by default "Indiv"). |
RightHand |
The code used in the database (and particularly in the "hand" variable) for "RightHand". If "RightHand" is coded as "Right" write RightHand = "Right" (by default "R"). |
LeftHand |
The code used in the database (and particularly in the "hand" variable) for "LeftHand". If "LeftHand" is coded as "Left" write LeftHand = "Left" (by default "L"). |
col |
A list of color for the bars of the histogram. By default it will automatically find the number of colors you need but it's using the 8 colors of the default palette of R. If you need more don't forget to select another palette or to name the color you want to add. |
ylab |
A title for the y axis. |
main |
The main title of the graph. |
legend.text |
If legend.text = TRUE, the legend will be automatically placed on the graph. If legend.text = FALSE, no legend will appear except if legendlocation = TRUE. |
beside |
If FALSE, the columns of height are portrayed as stacked bars, and if TRUE the columns are portrayed as juxtaposed bars. |
ylim |
The minimum and maximum value of the y axis. For example ylim = c(0,500). By default (ylim = NULL) the values are automatically selected. |
names.arg |
Plot the name of the arguments under each bar of the barplot. If names.args=FALSE, one should choose to turn to TRUE legend.text or legendlocation. |
legendlocation |
If TRUE you will have to click where you want to place the legend after the plot is done. |
standarderror |
If standarderror=TRUE standard error bars will be plotted for each bar of the barplot. |
cex |
A numeric giving the size of the legend characters. |
pt.cex |
A numeric giving the size of the legend points. |
pch |
This can either be a single character or an integer code for one of a set of graphics symbols. This will be applied to the legend. (By default pch = 15 which is square). |
horiz |
If horiz = TRUE, the legend will be displayed horizontally. If horiz = FALSE (by default), the legend will be displayed vertically. |
savetable |
This arguments permits to save directly the results of the function in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
file |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "HImeanPerIndiv.csv") |
Details
The mean HI is calculated from the HI of each individual for each task performed.
Value
The function returns results of class "data.frame".
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com>
Examples
## With arguments corresponding to the default ones:
data(laterdata)
str(laterdata)
Data<-laterdata
HImeanind(Data, catch="Food", hand="Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", horiz = FALSE)
## or
HImeanind(Data, horiz = FALSE)
## With arguments different from the default ones:
data(lateradata)
str(lateradata)
Data<-lateradata
HImeanind(Data, catch="Act", hand="HandPref", indiv = "Individual",
RightHand = "Right", LeftHand = "Left", horiz = FALSE)
HImeanindabs: this function calculates the absolute mean Handedness Index of each individual.
Description
Calculates the absolute mean Handedness Index of each individual and plots the corresponding histogram. The results can be saved in a .csv file.
Usage
HImeanindabs(data, catch = "Food", hand = "Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", col = 2:((length(levels
(data[[indiv]]))) + 1), ylab = "Mean handedness index",
main = "Hand preference regarding to the individuals",
legend.text = FALSE, beside = TRUE, ylim = c(-1, 1), names.arg=levels(data[[indiv]]),
legendlocation = FALSE, standarderror=TRUE, cex = 1, pt.cex = 2, pch = 15,
horiz = FALSE, savetable = FALSE, file = "HImeanIndivabs.csv")
Arguments
data |
The object (data.frame) containing your data with at least the qualitative variables concerning the hand used (hand), the individuals (indiv) and the activity performed (catch). |
catch |
The name/header of the column concerning the activity carried out (by default "Food"), if you made individuals catching different objects (ob1, ob2, ob3, ob4) and named the variale "ObjectCatched", write catch = "ObjectCatched". |
hand |
The name/header of the column concerning the hand used (by default "Hand"). |
indiv |
The name/header of the column concerning the individuals (by default "Indiv"). |
RightHand |
The code used in the database (and particularly in the "hand" variable) for "RightHand". If "RightHand" is coded as "Right" write RightHand = "Right" (by default "R"). |
LeftHand |
The code used in the database (and particularly in the "hand" variable) for "LeftHand". If "LeftHand" is coded as "Left" write LeftHand = "Left" (by default "L"). |
col |
A list of color for the bars of the histogram. By default it will automatically find the number of colors you need but it's using the 8 colors of the default palette of R. If you need more don't forget to select another palette or to name the color you want to add. |
ylab |
A title for the y axis. |
main |
The main title of the graph. |
legend.text |
If legend.text = TRUE, the legend will be automatically placed on the graph. If legend.text = FALSE, no legend will appear except if legendlocation = TRUE. |
beside |
If FALSE, the columns of height are portrayed as stacked bars, and if TRUE the columns are portrayed as juxtaposed bars. |
ylim |
The minimum and maximum value of the y axis. For example ylim = c(0,500). By default (ylim = NULL) the values are automatically selected. |
names.arg |
Plot the name of the arguments under each bar of the barplot. If names.args=FALSE, one should choose to turn to TRUE legend.text or legendlocation. |
legendlocation |
If TRUE you will have to click where you want to place the legend after the plot is done. |
standarderror |
If standarderror=TRUE standard error bars will be plotted for each bar of the barplot. |
cex |
A numeric giving the size of the legend characters. |
pt.cex |
A numeric giving the size of the legend points. |
pch |
This can either be a single character or an integer code for one of a set of graphics symbols. This will be applied to the legend. (By default pch = 15 which is square). |
horiz |
If horiz = TRUE, the legend will be displayed horizontally. If horiz = FALSE (by default), the legend will be displayed vertically. |
savetable |
This arguments permits to save directly the results of the function in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
file |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "HImeanIndivabs.csv") |
Value
The function returns results of class "data.frame".
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com>
Examples
## With arguments corresponding to the default ones:
data(laterdata)
str(laterdata)
Data<-laterdata
HImeanindabs(Data, catch="Food", hand="Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", horiz = FALSE)
## or
HImeanindabs(Data, horiz = FALSE)
## With arguments different from the default ones:
data(lateradata)
str(lateradata)
Data<-lateradata
HImeanindabs(Data, catch="Act", hand="HandPref", indiv = "Individual",
RightHand = "Right", LeftHand = "Left", horiz = FALSE)
HIndiv: this function calculates the Handedness Index of each individual for each activity and plots the corresponding histogram.
Description
Calculates the Handedness Index of each individual regarding to each task performed and plots the corresponding histogram for each individual. The results can be saved in a .csv file.
Usage
HIndiv(data, catch = "Food", hand = "Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", col = 1:length(levels
(data[[catch]])), ylab = "Handedness index",
main = "Hand preference regarding to the performed task by each individual",
cex.main = 1, legend.text = FALSE,
beside = TRUE, ylim = c(-1, 1), vlines = TRUE, hlines = TRUE,
legendlocation = TRUE, cex = 1, pt.cex = 2, pch = 15,
savetable = FALSE, file = "HIperIndiv.csv")
Arguments
data |
The object (data.frame) containing your data with at least the qualitative variables concerning the hand used (hand), the individuals (indiv) and the activity performed (catch). |
catch |
The name/header of the column concerning the activity carried out (by default "Food"), if you made individuals catching different objects (ob1, ob2, ob3, ob4) and named the variale "ObjectCatched", write catch = "ObjectCatched". |
hand |
The name/header of the column concerning the hand used (by default "Hand"). |
indiv |
The name/header of the column concerning the individuals (by default "Indiv"). |
RightHand |
The code used in the database (and particularly in the "hand" variable) for "RightHand". If "RightHand" is coded as "Right" write RightHand = "Right" (by default "R"). |
LeftHand |
The code used in the database (and particularly in the "hand" variable) for "LeftHand". If "LeftHand" is coded as "Left" write LeftHand = "Left" (by default "L"). |
col |
A list of color for the bars of the histogram. By default it will automatically find the number of colors you need but it's using the 8 colors of the default palette of R. If you need more don't forget to select another palette or to name the color you want to add. |
ylab |
A title for the y axis. |
main |
The main title of the graph. |
cex.main |
A numeric giving the size of the main title characters. |
legend.text |
If legend.text = TRUE, the legend will be automatically placed on the graph. If legend.text = FALSE, no legend will appear except if legendlocation = TRUE. |
beside |
If FALSE, the columns of height are portrayed as stacked bars, and if TRUE the columns are portrayed as juxtaposed bars. |
ylim |
The minimum and maximum value of the y axis. For example ylim = c(0,500). By default (ylim = NULL) the values are automatically selected. |
vlines |
If vlines = TRUE (by default), vertical lines are drawn between the histogram of each individual. |
hlines |
If hlines = TRUE (by defaut), horizontal lines are drawn at y = 0 for each histogram. |
legendlocation |
If TRUE you will have to click where you want to place the legend after the plot is done. |
cex |
A numeric giving the size of the legend characters. |
pt.cex |
A numeric giving the size of the legend points. |
pch |
This can either be a single character or an integer code for one of a set of graphics symbols. This will be applied to the legend. (By default pch = 15 which is square). |
savetable |
This arguments permits to save directly the results of the function in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
file |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "HIperIndiv.csv") |
Value
The function returns results of class "matrix".
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com>
Examples
## With arguments corresponding to the default ones:
data(laterdata)
str(laterdata)
Data<-laterdata
HIndiv(Data, catch="Food", hand="Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", legendlocation=FALSE, legend.text=TRUE)
## or
HIndiv(Data, legendlocation=FALSE, legend.text=TRUE)
## With arguments different from the default ones:
data(lateradata)
str(lateradata)
Data<-lateradata
HIndiv(Data, catch="Act", hand="HandPref", indiv = "Individual",
RightHand = "Right", LeftHand = "Left", legendlocation=FALSE, legend.text=TRUE)
HIndivabs: this function calculates the absolute Handedness Index of each individual for each activity and plots the corresponding histogram.
Description
Calculates the absolute Handedness Index of each individual regarding to each task performed and plots the corresponding histogram for each individual. The results can be saved in a .csv file.
Usage
HIndivabs(data, catch = "Food", hand = "Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", col = 1:length(levels
(data[[catch]])), ylab = "Absolute handedness index",
main = "Hand preference regarding to the performed task by each individual",
cex.main = 1, legend.text = FALSE, beside = TRUE,
ylim = c(0, 1), vlines = TRUE, hlines = TRUE, legendlocation = TRUE,
cex = 1, pt.cex = 2, pch = 15, savetable = FALSE,
file = "HIperIndivabs.csv")
Arguments
data |
The object (data.frame) containing your data with at least the qualitative variables concerning the hand used (hand), the individuals (indiv) and the activity performed (catch). |
catch |
The name/header of the column concerning the activity carried out (by default "Food"), if you made individuals catching different objects (ob1, ob2, ob3, ob4) and named the variale "ObjectCatched", write catch = "ObjectCatched". |
hand |
The name/header of the column concerning the hand used (by default "Hand"). |
indiv |
The name/header of the column concerning the individuals (by default "Indiv"). |
RightHand |
The code used in the database (and particularly in the "hand" variable) for "RightHand". If "RightHand" is coded as "Right" write RightHand = "Right" (by default "R"). |
LeftHand |
The code used in the database (and particularly in the "hand" variable) for "LeftHand". If "LeftHand" is coded as "Left" write LeftHand = "Left" (by default "L"). |
col |
A list of color for the bars of the histogram. By default it will automatically find the number of colors you need but it's using the 8 colors of the default palette of R. If you need more don't forget to select another palette or to name the color you want to add. |
ylab |
A title for the y axis. |
main |
The main title of the graph. |
cex.main |
A numeric giving the size of the main title characters. |
legend.text |
If legend.text = TRUE, the legend will be automatically placed on the graph. If legend.text = FALSE, no legend will appear except if legendlocation = TRUE. |
beside |
If FALSE, the columns of height are portrayed as stacked bars, and if TRUE the columns are portrayed as juxtaposed bars. |
ylim |
The minimum and maximum value of the y axis. For example ylim = c(0,500). By default (ylim = NULL) the values are automatically selected. |
vlines |
If vlines = TRUE (by default), vertical lines are drawn between the histogram of each individual. |
hlines |
If hlines = TRUE (by defaut), horizontal lines are drawn at y = 0 for each histogram. |
legendlocation |
If TRUE you will have to click where you want to place the legend after the plot is done. |
cex |
A numeric giving the size of the legend characters. |
pt.cex |
A numeric giving the size of the legend points. |
pch |
This can either be a single character or an integer code for one of a set of graphics symbols. This will be applied to the legend. (By default pch = 15 which is square). |
savetable |
This arguments permits to save directly the results of the function in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
file |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "HIperIndivabs.csv") |
Value
The function returns results of class "matrix".
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com>
Examples
## With arguments corresponding to the default ones:
data(laterdata)
str(laterdata)
Data<-laterdata
HIndivabs(Data, catch="Food", hand="Hand", indiv = "Indiv",
RightHand = "R", LeftHand = "L", legendlocation=FALSE, legend.text=TRUE)
## or
HIndivabs(Data, legendlocation=FALSE, legend.text=TRUE)
## With arguments different from the default ones:
data(lateradata)
str(lateradata)
Data<-lateradata
HIndivabs(Data, catch="Act", hand="HandPref", indiv = "Individual",
RightHand = "Right", LeftHand = "Left", legendlocation=FALSE, legend.text=TRUE)
later: this function calculates handedness index (HI) and z-score.
Description
Returns an array with x dimensions corresponding to each activities performed. For each individual it will return the total of left and right hand grasp (and eventually other data like "bimanual" for example). The HI and the z-score is also returned for each individual with the corresponding p-value and each individual is classified as right handed (R), left handed (L) or ambiguous (A). These results can be saved directly in a .csv file (see "savetable" below).
Usage
later(data, catch = "Food", indiv = "Indiv", hand = "Hand",
RightHand = "R", LeftHand = "L", savetable = FALSE,
file = "HIz.csv")
Arguments
data |
The object (data.frame) containing your data with at least the qualitative variables concerning the hand used (hand), the individuals (indiv) and the activity performed (catch). |
catch |
The name/header of the column concerning the activity carried out (by default "Food"), if you made individuals catching different objects (ob1, ob2, ob3, ob4) and named the variale "ObjectCatched", write catch = "ObjectCatched". |
indiv |
The name/header of the column concerning the individuals (by default "Indiv"). |
hand |
The name/header of the column concerning the hand used (by default "Hand"). |
RightHand |
The code used in the database (and particularly in the "hand" variable) for "RightHand". If "RightHand" is coded as "Right" write RightHand = "Right" (by default "R"). |
LeftHand |
The code used in the database (and particularly in the "hand" variable) for "LeftHand". If "LeftHand" is coded as "Left" write LeftHand = "Left" (by default "L"). |
savetable |
This arguments permits to save directly the results of the function in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
file |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "HIz.csv") |
Details
The order of the columns of the database doesn't matter, the important is to give the correct code and header name to each argument of the function if the default ones are not appropriate.
Value
The function returns results of class "array".
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com>
References
Hopkins W.D.(1999) On the Other Hand: Statistical Issues in the Assessment and Interpretation of Hand Preference Data in Nonhuman Primates. International Journal of Primatology 20(6):851-866
Examples
## With arguments corresponding to the default ones:
data(laterdata)
str(laterdata)
Data<-laterdata
later(Data, catch ="Food", indiv="Indiv", hand="Hand",
RightHand="R", LeftHand="L", savetable = FALSE, file = "HIz.csv")
## or
later(Data)
## With arguments different from the default ones:
data(lateradata)
str(lateradata)
Data<-lateradata
later(Data, catch ="Act", indiv="Individual", hand="HandPref",
RightHand="Right", LeftHand="Left", savetable = FALSE,
file = "HIz.csv")
laterAFCM: this function calculates disjunctive table, Burt table and contributions for multiple correspondence analysis (MCA).
Description
Calculates disjunctive table, Burt table and contributions for MCA.
Usage
laterAFCM(data, scannf=FALSE, nf=2, saveDatadisj = FALSE, fileDatadisj = "Datadisj.csv",
saveSumcolDatadisj = FALSE, fileSumcolDatadisj = "SumcolDatadisj.csv",
saveDataburt = FALSE, fileDataburt = "Databurt.csv",
saveContributions = FALSE, fileContributions = "Contributions.csv")
Arguments
data |
A data.frame with the qualitative variables which should be taken in account in the multiple correspondence analysis. |
scannf |
A logical value indicating whether the eigenvalues bar plot should be displayed; see ade4 package (by default scannf = FALSE). |
nf |
If scannf=FALSE, an integer indicating the number of kept axes; see ade4 package (by default nf = 2). |
saveDatadisj |
This arguments permits to save directly the results of the disjunctive table in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
fileDatadisj |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "Datadisj.csv") |
saveSumcolDatadisj |
This arguments permits to save directly the results of the sum of the column of the disjunctive table in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
fileSumcolDatadisj |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "SumcolDatadisj.csv") |
saveDataburt |
This arguments permits to save directly the results of the Burt table in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
fileDataburt |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "Databurt.csv") |
saveContributions |
This arguments permits to save directly the results of the contributions table in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
fileContributions |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "Contributions.csv") |
Value
The function returns results of class "list".
Note
If you use this function please cite also ade4-package.
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com> based on functions from Daniel Chessel, Anne-Beatrice Dufour and Stephane Dray, with contributions from Thibaut Jombart, Jean R. Lobry, Sebastien Ollier, Sandrine Pavoine and Jean Thioulouse. Package ade4: Analysis of Ecological Data : Exploratory and Euclidean methods in Environmental sciences.
References
Chessel D., Dufour A.-B. and Dray S., with contributions from Jombart T., Lobry J.R., Ollier S., Pavoine S. and Thioulouse J. Package ade4: Analysis of Ecological Data : Exploratory and Euclidean methods in Environmental sciences.
See Also
ade4
,inertia.dudi
, acm.disjonctif
, acm.burt
, dudi.acm
Examples
data(laterdata)
## Without saving:
laterAFCM(laterdata)
lateradata: data.frame for later-package examples
Description
This data.frame is a fake example made up to illustrate later-package.
Usage
data(lateradata)
Format
A data frame with 674 observations on the following 5 variables.
Individual
a factor with levels
Airly
Biwa
Doma
Dudy
Gogo
Neil
Olix
Rali
Raps
Rexen
Titi
Sex
a factor with levels
f
m
Act
a factor with levels
Catching
Grasping
Hunting
HandPref
a factor with levels
Bimanual
Left
Right
PostureCorp
a factor with levels
A
Bip
BipGrill
BipT
NonObs
T
TT
Source
Fake data.
Examples
data(lateradata)
str(lateradata)
laterdata: data.frame for later-package examples
Description
This data.frame is a fake example made up to illustrate later-package.
Usage
data(laterdata)
Format
A data frame with 674 observations on the following 5 variables.
Indiv
a factor with levels
Airly
Biwa
Doma
Dudy
Gogo
Neil
Olix
Rali
Raps
Rexen
Titi
Sex
a factor with levels
f
m
Food
a factor with levels
Apple
Cricket
Worm
Hand
a factor with levels
Bi
L
R
PostureCorp
a factor with levels
A
Bip
BipGrill
BipT
NonObs
T
TT
Source
Fake data.
Examples
data(laterdata)
str(laterdata)
laterhist: this function plots an histogram of the different type of grasp (Left, right, bimanual...) for each kind of activity.
Description
Counts the number of occurences of each type of grasp and plot the corresponding histogram for each task performed.
Usage
laterhist(data, catch = "Food", hand = "Hand",
col = 1:nlevels(data[[hand]]), ylim = NULL,
ylab = "Number of grips",
main = "Type of grips regarding to the performed task",
legend.text = FALSE, beside = TRUE, legendlocation = TRUE,
cex = 1, pt.cex = 2, pch = 15)
Arguments
data |
the object (data.frame) containing your data with at least the qualitative variables concerning the hand used (hand) and the activity performed (catch). |
catch |
The name/header of the column concerning the activity carried out (by default "Food"), if you made individuals catching different objects (ob1, ob2, ob3, ob4) and named the variale "ObjectCatched", write catch = "ObjectCatched". |
hand |
The name/header of the column concerning the hand used (by default "Hand"). |
col |
A list of color for the bars of the histogram. By default it will automatically find the number of colors you need but it's using the 8 colors of the default palette of R. If you need more don't forget to select another palette or to name the color you want to add. |
ylim |
The minimum and maximum value of the y axis. For example ylim = c(0,500). By default (ylim = NULL) the values are automatically selected. |
ylab |
A title for the y axis. |
main |
The main title of the graph. |
legend.text |
If legend.text = TRUE, the legend will be automatically placed on the graph. If legend.text = FALSE, no legend will appear except if legendlocation = TRUE. |
beside |
If FALSE, the columns of height are portrayed as stacked bars, and if TRUE the columns are portrayed as juxtaposed bars. |
legendlocation |
If TRUE you will have to click where you want to place the legend after the plot is done. |
cex |
A numeric giving the size of the legend characters. |
pt.cex |
A numeric giving the size of the legend points. |
pch |
This can either be a single character or an integer code for one of a set of graphics symbols. This will be applied to the legend. (By default pch = 15 which is square). |
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com>
References
Meguerditchian A., Calcutt S.E., Lonsdorf E.V., Ross S.R. and Hopkins W.D. (2010) Brief communication: Captive Gorillas are right-handed for bimanual feeding. American Journal of Physical Anthropology 141:638-645.
See Also
Examples
## With arguments corresponding to the default ones:
data(laterdata)
str(laterdata)
Data<-laterdata
laterhist(Data, catch ="Food", hand="Hand",
legend.text = TRUE, legendlocation = FALSE)
## or
laterhist(Data, legend.text = TRUE, legendlocation = FALSE)
## With arguments different from the default ones:
data(lateradata)
str(lateradata)
Data<-lateradata
laterhist(Data, catch ="Act", hand="HandPref", legend.text = TRUE, legendlocation = FALSE)
lvisAFCM: this function calculates disjonctive table, blurt table and contributions for AFCM and plots the corresponding graphs.
Description
Combines "laterAFCM" and "visAFCM" functions. It calculates disjunctive table, Burt table and contributions for MCA and then plots multiple correspondence analysis graphs.
Usage
lvisAFCM(data, scannf=FALSE, nf=2, xax = 1, yax = 2, clab.row = FALSE, clab.col = 1,
permute = FALSE, posieig = "top", sub = NULL,
graphstyle = "unique", graphrow = 1, graphcol = 3, cpoint = 1,
clabel = 2, csub = 2, saveDatadisj = FALSE,
fileDatadisj = "Datadisj.csv", saveSumcolDatadisj = FALSE,
fileSumcolDatadisj = "SumcolDatadisj.csv", saveDataburt = FALSE,
fileDataburt = "Databurt.csv", saveContributions = FALSE,
fileContributions = "Contributions.csv")
Arguments
data |
A data.frame with the qualitative variables which should be taken in account in the multiple correspondence analysis. |
scannf |
A logical value indicating whether the eigenvalues bar plot should be displayed; see ade4 package (by default scannf = FALSE). |
nf |
If scannf=FALSE, an integer indicating the number of kept axes; see ade4 package (by default nf = 2). |
xax |
A numeric giving the number of the first axis to plot (by default xax = 1). |
yax |
A numeric giving the number of the second axis to plot (by default yax = 2). |
clab.row |
A character size for the rows (by default clab.row = FALSE). |
clab.col |
A character size for the columns (by default clab.col = 1). |
permute |
If FALSE, the rows are plotted by points and the columns by arrows. If TRUE it is the opposite (by default permute = FALSE). |
posieig |
If "top" the eigenvalues bar plot is upside, if "bottom" it is downside, if "none" no plot. "topleft" and "bottomleft" are also possible (by default posieig = "top"). |
sub |
A string of characters to be inserted as legend (by default sub = NULL). |
graphstyle |
Three kinds of graph can be selected. If graphstyle = "unique", all variables will be plotted on the same graph. If graphstyle = "multiple a" each variable will be plotted in different graphs (cf. graphrow and graphcol) with inertia ellipse. If graphstyle = "multiple b" each variable will be plotted in different graphs (cf. graphrow and graphcol) with convex hulls. |
graphrow |
The number of row for multiple graph. If one deal with 6 variables it is recommended to write graphrow = 2 and graphcol = 3. |
graphcol |
The number of column for multiple graph. If one deal with 6 variables it is recommended to write graphrow = 2 and graphcol = 3. |
cpoint |
A numeric for the size of the points. |
clabel |
A numeric for the size of the labels. |
csub |
A numeric for the size of the name of the variable written at the bottom of each chart. |
saveDatadisj |
This arguments permits to save directly the results of the disjunctive table in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
fileDatadisj |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "Datadisj.csv") |
saveSumcolDatadisj |
This arguments permits to save directly the results of the sum of the column of the disjunctive table in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
fileSumcolDatadisj |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "SumcolDatadisj.csv") |
saveDataburt |
This arguments permits to save directly the results of the Burt table in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
fileDataburt |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "Databurt.csv") |
saveContributions |
This arguments permits to save directly the results of the contributions table in a .csv file in the workspace of R. If savetable = "csv" there will be "." for the decimal point and a "," for the separator. If savetable = "csv2" there will be "," for the decimal point and a ";" for the separator. (by default savetable = FALSE) |
fileContributions |
This argument will work if savetable = "csv" or "csv2". It gives the name of the csv file saved (by default file = "Contributions.csv") |
Value
The function returns results of class "list".
Note
If you use this function please cite also ade4-package.
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com> based on functions from Daniel Chessel, Anne-Beatrice Dufour and Stephane Dray, with contributions from Thibaut Jombart, Jean R. Lobry, Sebastien Ollier, Sandrine Pavoine and Jean Thioulouse. Package ade4: Analysis of Ecological Data : Exploratory and Euclidean methods in Environmental sciences.
References
Daniel Chessel, Anne-Beatrice Dufour and Stephane Dray, with contributions from Thibaut Jombart, Jean R. Lobry, Sebastien Ollier, Sandrine Pavoine and Jean Thioulouse. Package ade4: Analysis of Ecological Data : Exploratory and Euclidean methods in Environmental sciences.
See Also
ade4
,inertia.dudi
, acm.disjonctif
, acm.burt
, dudi.acm
, scatter.dudi
, s.class
, s.chull
Examples
data(laterdata)
## Without saving:
## "unique" graph:
lvisAFCM(laterdata)
## "multiple a" graph:
lvisAFCM(laterdata, xax = 1, yax = 2, clab.row = FALSE,
clab.col = 1,permute = FALSE, posieig = "top", sub = NULL,
graphstyle = "multiple a", graphrow = 2, graphcol = 3,
cpoint=3)
## "multiple b" graph:
lvisAFCM(laterdata, xax = 1, yax = 2, clab.row = FALSE,
clab.col = 1,permute = FALSE, posieig = "top", sub = NULL,
graphstyle = "multiple b", graphrow = 2, graphcol = 3)
visAFCM: this function plots multiple correspondence analysis graphs based on ade4 package functions.
Description
Plots multiple correspondence analysis graphs. The graphs can be unique or multiple which is sometimes necessary for better lisibility.
Usage
visAFCM(data, scannf=FALSE, nf=2, xax = 1, yax = 2, clab.row = FALSE, clab.col = 1,
permute = FALSE, posieig = "top", sub = NULL, graphstyle = "unique",
graphrow = 1, graphcol = 3, cpoint = 1, clabel = 2, csub = 2)
Arguments
data |
A data.frame with the qualitative variables which should be taken in account in the multiple correspondence analysis. |
scannf |
A logical value indicating whether the eigenvalues bar plot should be displayed; see ade4 package (by default scannf = FALSE). |
nf |
If scannf=FALSE, an integer indicating the number of kept axes; see ade4 package (by default nf = 2). |
xax |
A numeric giving the number of the first axis to plot (by default xax = 1). |
yax |
A numeric giving the number of the second axis to plot (by default yax = 2). |
clab.row |
A character size for the rows (by default clab.row = FALSE). |
clab.col |
A character size for the columns (by default clab.col = 1). |
permute |
If FALSE, the rows are plotted by points and the columns by arrows. If TRUE it is the opposite (by default permute = FALSE). |
posieig |
If "top" the eigenvalues bar plot is upside, if "bottom" it is downside, if "none" no plot. "topleft" and "bottomleft" are also possible (by default posieig = "top"). |
sub |
A string of characters to be inserted as legend (by default sub = NULL). |
graphstyle |
Three kinds of graph can be selected. If graphstyle = "unique", all variables will be plotted on the same graph. If graphstyle = "multiple a" each variable will be plotted in different graphs (cf. graphrow and graphcol) with inertia ellipse. If graphstyle = "multiple b" each variable will be plotted in different graphs (cf. graphrow and graphcol) with convex hulls. |
graphrow |
The number of row for multiple graph. If one deal with 6 variables it is recommended to write graphrow = 2 and graphcol = 3. |
graphcol |
The number of column for multiple graph. If one deal with 6 variables it is recommended to write graphrow = 2 and graphcol = 3. |
cpoint |
A numeric for the size of the points. |
clabel |
A numeric for the size of the labels. |
csub |
A numeric for the size of the name of the variable written at the bottom of each chart. |
Note
If you use this function please cite also ade4-package.
Author(s)
Borel A., Pouydebat E., Reghem E. <antony.borel@gmail.com> based on functions from Daniel Chessel, Anne-Beatrice Dufour and Stephane Dray, with contributions from Thibaut Jombart, Jean R. Lobry, Sebastien Ollier, Sandrine Pavoine and Jean Thioulouse. Package ade4: Analysis of Ecological Data : Exploratory and Euclidean methods in Environmental sciences.
References
Daniel Chessel, Anne-Beatrice Dufour and Stephane Dray, with contributions from Thibaut Jombart, Jean R. Lobry, Sebastien Ollier, Sandrine Pavoine and Jean Thioulouse. Package ade4: Analysis of Ecological Data : Exploratory and Euclidean methods in Environmental sciences.
See Also
scatter.dudi
, s.class
, s.chull
Examples
data(laterdata)
## "unique" graph:
visAFCM(laterdata)
## "multiple a" graph:
visAFCM(laterdata, xax = 1, yax = 2, clab.row = FALSE, clab.col = 1,
permute = FALSE, posieig = "top", sub = NULL, graphstyle = "multiple a",
graphrow = 2, graphcol = 3, cpoint=3)
## "multiple b" graph:
visAFCM(laterdata, xax = 1, yax = 2, clab.row = FALSE, clab.col = 1,
permute = FALSE, posieig = "top", sub = NULL, graphstyle = "multiple b",
graphrow = 2, graphcol = 3)