R: later: this function calculates handedness index (HI) and...
later
R Documentation
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).
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")
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Laterality)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Laterality/later.Rd_%03d_medium.png", width=480, height=480)
> ### Name: later
> ### Title: later: this function calculates handedness index (HI) and
> ### z-score.
> ### Aliases: later
> ### Keywords: HI handedness index zscore laterality manual preference
>
> ### ** Examples
>
> ## With arguments corresponding to the default ones:
> data(laterdata)
> str(laterdata)
'data.frame': 674 obs. of 5 variables:
$ Indiv : Factor w/ 11 levels "Airly","Biwa",..: 11 9 6 8 3 11 9 6 11 10 ...
$ Sex : Factor w/ 2 levels "f","m": 2 2 1 1 1 2 2 1 2 1 ...
$ Food : Factor w/ 3 levels "Apple","Cricket",..: 1 1 1 1 1 1 1 1 1 1 ...
$ Hand : Factor w/ 3 levels "Bi","L","R": 3 3 1 2 2 1 3 3 3 3 ...
$ PostureCorp: Factor w/ 7 levels "A","Bip","BipGrill",..: 6 7 2 7 6 1 6 6 6 6 ...
> Data<-laterdata
> later(Data, catch ="Food", indiv="Indiv", hand="Hand",
+ RightHand="R", LeftHand="L", savetable = FALSE, file = "HIz.csv")
-----------------------------------------
-1 </= HI </= 1
If HI > 0 -> right hand preference
If HI < 0 -> left hand preference
-----------------------------------------
for alpha = 0.05
If z </= -1.96 -> left-handed (L)
If z >/= 1.96 -> right-handed (R)
If -1.96 < z < 1.96 -> ambiguously handed (A)
-----------------------------------------
if p.val > 0.05 -> .
if p.val <= 0.05 -> *
if p.val <= 0.01 -> **
-----------------------------------------
, , Apple
Bi L R HI z p.val Hand Signif
Airly "0" "17" "16" "-0.03030303" "-0.1740777" "0.8618044330" "A" "."
Biwa "1" "14" " 6" "-0.40000000" "-1.7888544" "0.0736382701" "A" "."
Doma "0" " 4" " 6" " 0.20000000" " 0.6324555" "0.5270892569" "A" "."
Dudy "0" "10" "14" " 0.16666667" " 0.8164966" "0.4142161782" "A" "."
Gogo "0" "14" " 0" "-1.00000000" "-3.7416574" "0.0001828106" "L" "**"
Neil "1" "12" "25" " 0.35135135" " 2.1371868" "0.0325827984" "R" "*"
Olix "0" " 3" " 1" "-0.50000000" "-1.0000000" "0.3173105079" "A" "."
Rali "2" "11" "28" " 0.43589744" " 2.7221786" "0.0064853080" "R" "**"
Raps "0" "17" "20" " 0.08108108" " 0.4931970" "0.6218734243" "A" "."
Rexen "0" "12" "10" "-0.09090909" "-0.4264014" "0.6698153576" "A" "."
Titi "3" " 9" "16" " 0.28000000" " 1.4000000" "0.1615133185" "A" "."
, , Cricket
Bi L R HI z p.val Hand Signif
Airly "0" " 7" "0" "-1.0000000" "-2.6457513" "0.0081509716" "L" "**"
Biwa "0" " 2" "1" "-0.3333333" "-0.5773503" "0.5637028617" "A" "."
Doma "0" " 8" "3" "-0.4545455" "-1.5075567" "0.1316680160" "A" "."
Dudy "0" " 0" "0" NA NA NA NA NA
Gogo "0" " 0" "0" NA NA NA NA NA
Neil "0" " 5" "0" "-1.0000000" "-2.2360680" "0.0253473187" "L" "*"
Olix "0" " 3" "2" "-0.2000000" "-0.4472136" "0.6547208460" "A" "."
Rali "0" " 0" "0" NA NA NA NA NA
Raps "0" " 5" "3" "-0.2500000" "-0.7071068" "0.4795001222" "A" "."
Rexen "3" "17" "2" "-0.7894737" "-3.4412360" "0.0005790632" "L" "**"
Titi "2" " 0" "5" " 1.0000000" " 2.2360680" "0.0253473187" "R" "*"
, , Worm
Bi L R HI z p.val Hand Signif
Airly "0" "16" " 4" "-0.6000000" "-2.683282" "7.290358e-03" "L" "**"
Biwa "0" "27" " 2" "-0.8620690" "-4.642383" "3.444129e-06" "L" "**"
Doma "2" "52" "42" "-0.1063830" "-1.031421" "3.023433e-01" "A" "."
Dudy "0" " 2" " 0" "-1.0000000" "-1.414214" "1.572992e-01" "A" "."
Gogo "0" " 5" " 0" "-1.0000000" "-2.236068" "2.534732e-02" "L" "*"
Neil "1" " 9" " 3" "-0.5000000" "-1.732051" "8.326452e-02" "A" "."
Olix "0" "15" " 9" "-0.2500000" "-1.224745" "2.206714e-01" "A" "."
Rali "0" " 2" " 5" " 0.4285714" " 1.133893" "2.568393e-01" "A" "."
Raps "1" "16" " 6" "-0.4545455" "-2.132007" "3.300626e-02" "L" "*"
Rexen "0" "83" "13" "-0.7291667" "-7.144345" "9.042597e-13" "L" "**"
Titi "1" "11" " 7" "-0.2222222" "-0.942809" "3.457786e-01" "A" "."
> ## or
> later(Data)
-----------------------------------------
-1 </= HI </= 1
If HI > 0 -> right hand preference
If HI < 0 -> left hand preference
-----------------------------------------
for alpha = 0.05
If z </= -1.96 -> left-handed (L)
If z >/= 1.96 -> right-handed (R)
If -1.96 < z < 1.96 -> ambiguously handed (A)
-----------------------------------------
if p.val > 0.05 -> .
if p.val <= 0.05 -> *
if p.val <= 0.01 -> **
-----------------------------------------
, , Apple
Bi L R HI z p.val Hand Signif
Airly "0" "17" "16" "-0.03030303" "-0.1740777" "0.8618044330" "A" "."
Biwa "1" "14" " 6" "-0.40000000" "-1.7888544" "0.0736382701" "A" "."
Doma "0" " 4" " 6" " 0.20000000" " 0.6324555" "0.5270892569" "A" "."
Dudy "0" "10" "14" " 0.16666667" " 0.8164966" "0.4142161782" "A" "."
Gogo "0" "14" " 0" "-1.00000000" "-3.7416574" "0.0001828106" "L" "**"
Neil "1" "12" "25" " 0.35135135" " 2.1371868" "0.0325827984" "R" "*"
Olix "0" " 3" " 1" "-0.50000000" "-1.0000000" "0.3173105079" "A" "."
Rali "2" "11" "28" " 0.43589744" " 2.7221786" "0.0064853080" "R" "**"
Raps "0" "17" "20" " 0.08108108" " 0.4931970" "0.6218734243" "A" "."
Rexen "0" "12" "10" "-0.09090909" "-0.4264014" "0.6698153576" "A" "."
Titi "3" " 9" "16" " 0.28000000" " 1.4000000" "0.1615133185" "A" "."
, , Cricket
Bi L R HI z p.val Hand Signif
Airly "0" " 7" "0" "-1.0000000" "-2.6457513" "0.0081509716" "L" "**"
Biwa "0" " 2" "1" "-0.3333333" "-0.5773503" "0.5637028617" "A" "."
Doma "0" " 8" "3" "-0.4545455" "-1.5075567" "0.1316680160" "A" "."
Dudy "0" " 0" "0" NA NA NA NA NA
Gogo "0" " 0" "0" NA NA NA NA NA
Neil "0" " 5" "0" "-1.0000000" "-2.2360680" "0.0253473187" "L" "*"
Olix "0" " 3" "2" "-0.2000000" "-0.4472136" "0.6547208460" "A" "."
Rali "0" " 0" "0" NA NA NA NA NA
Raps "0" " 5" "3" "-0.2500000" "-0.7071068" "0.4795001222" "A" "."
Rexen "3" "17" "2" "-0.7894737" "-3.4412360" "0.0005790632" "L" "**"
Titi "2" " 0" "5" " 1.0000000" " 2.2360680" "0.0253473187" "R" "*"
, , Worm
Bi L R HI z p.val Hand Signif
Airly "0" "16" " 4" "-0.6000000" "-2.683282" "7.290358e-03" "L" "**"
Biwa "0" "27" " 2" "-0.8620690" "-4.642383" "3.444129e-06" "L" "**"
Doma "2" "52" "42" "-0.1063830" "-1.031421" "3.023433e-01" "A" "."
Dudy "0" " 2" " 0" "-1.0000000" "-1.414214" "1.572992e-01" "A" "."
Gogo "0" " 5" " 0" "-1.0000000" "-2.236068" "2.534732e-02" "L" "*"
Neil "1" " 9" " 3" "-0.5000000" "-1.732051" "8.326452e-02" "A" "."
Olix "0" "15" " 9" "-0.2500000" "-1.224745" "2.206714e-01" "A" "."
Rali "0" " 2" " 5" " 0.4285714" " 1.133893" "2.568393e-01" "A" "."
Raps "1" "16" " 6" "-0.4545455" "-2.132007" "3.300626e-02" "L" "*"
Rexen "0" "83" "13" "-0.7291667" "-7.144345" "9.042597e-13" "L" "**"
Titi "1" "11" " 7" "-0.2222222" "-0.942809" "3.457786e-01" "A" "."
>
> ## With arguments different from the default ones:
> data(lateradata)
> str(lateradata)
'data.frame': 674 obs. of 5 variables:
$ Individual : Factor w/ 11 levels "Airly","Biwa",..: 11 9 6 8 3 11 9 6 11 10 ...
$ Sex : Factor w/ 2 levels "f","m": 2 2 1 1 1 2 2 1 2 1 ...
$ Act : Factor w/ 3 levels "Catching","Grasping",..: 2 2 2 2 2 2 2 2 2 2 ...
$ HandPref : Factor w/ 3 levels "Bimanual","Left",..: 3 3 1 2 2 1 3 3 3 3 ...
$ PostureCorp: Factor w/ 7 levels "A","Bip","BipGrill",..: 6 7 2 7 6 1 6 6 6 6 ...
> Data<-lateradata
> later(Data, catch ="Act", indiv="Individual", hand="HandPref",
+ RightHand="Right", LeftHand="Left", savetable = FALSE,
+ file = "HIz.csv")
-----------------------------------------
-1 </= HI </= 1
If HI > 0 -> right hand preference
If HI < 0 -> left hand preference
-----------------------------------------
for alpha = 0.05
If z </= -1.96 -> left-handed (L)
If z >/= 1.96 -> right-handed (R)
If -1.96 < z < 1.96 -> ambiguously handed (A)
-----------------------------------------
if p.val > 0.05 -> .
if p.val <= 0.05 -> *
if p.val <= 0.01 -> **
-----------------------------------------
, , Catching
Bimanual Left Right HI z p.val Hand Signif
Airly "0" "16" " 4" "-0.6000000" "-2.683282" "7.290358e-03" "L" "**"
Biwa "0" "27" " 2" "-0.8620690" "-4.642383" "3.444129e-06" "L" "**"
Doma "2" "52" "42" "-0.1063830" "-1.031421" "3.023433e-01" "A" "."
Dudy "0" " 2" " 0" "-1.0000000" "-1.414214" "1.572992e-01" "A" "."
Gogo "0" " 5" " 0" "-1.0000000" "-2.236068" "2.534732e-02" "L" "*"
Neil "1" " 9" " 3" "-0.5000000" "-1.732051" "8.326452e-02" "A" "."
Olix "0" "15" " 9" "-0.2500000" "-1.224745" "2.206714e-01" "A" "."
Rali "0" " 2" " 5" " 0.4285714" " 1.133893" "2.568393e-01" "A" "."
Raps "1" "16" " 6" "-0.4545455" "-2.132007" "3.300626e-02" "L" "*"
Rexen "0" "83" "13" "-0.7291667" "-7.144345" "9.042597e-13" "L" "**"
Titi "1" "11" " 7" "-0.2222222" "-0.942809" "3.457786e-01" "A" "."
, , Grasping
Bimanual Left Right HI z p.val Hand Signif
Airly "0" "17" "16" "-0.03030303" "-0.1740777" "0.8618044330" "A" "."
Biwa "1" "14" " 6" "-0.40000000" "-1.7888544" "0.0736382701" "A" "."
Doma "0" " 4" " 6" " 0.20000000" " 0.6324555" "0.5270892569" "A" "."
Dudy "0" "10" "14" " 0.16666667" " 0.8164966" "0.4142161782" "A" "."
Gogo "0" "14" " 0" "-1.00000000" "-3.7416574" "0.0001828106" "L" "**"
Neil "1" "12" "25" " 0.35135135" " 2.1371868" "0.0325827984" "R" "*"
Olix "0" " 3" " 1" "-0.50000000" "-1.0000000" "0.3173105079" "A" "."
Rali "2" "11" "28" " 0.43589744" " 2.7221786" "0.0064853080" "R" "**"
Raps "0" "17" "20" " 0.08108108" " 0.4931970" "0.6218734243" "A" "."
Rexen "0" "12" "10" "-0.09090909" "-0.4264014" "0.6698153576" "A" "."
Titi "3" " 9" "16" " 0.28000000" " 1.4000000" "0.1615133185" "A" "."
, , Hunting
Bimanual Left Right HI z p.val Hand Signif
Airly "0" " 7" "0" "-1.0000000" "-2.6457513" "0.0081509716" "L" "**"
Biwa "0" " 2" "1" "-0.3333333" "-0.5773503" "0.5637028617" "A" "."
Doma "0" " 8" "3" "-0.4545455" "-1.5075567" "0.1316680160" "A" "."
Dudy "0" " 0" "0" NA NA NA NA NA
Gogo "0" " 0" "0" NA NA NA NA NA
Neil "0" " 5" "0" "-1.0000000" "-2.2360680" "0.0253473187" "L" "*"
Olix "0" " 3" "2" "-0.2000000" "-0.4472136" "0.6547208460" "A" "."
Rali "0" " 0" "0" NA NA NA NA NA
Raps "0" " 5" "3" "-0.2500000" "-0.7071068" "0.4795001222" "A" "."
Rexen "3" "17" "2" "-0.7894737" "-3.4412360" "0.0005790632" "L" "**"
Titi "2" " 0" "5" " 1.0000000" " 2.2360680" "0.0253473187" "R" "*"
>
>
>
>
>
> dev.off()
null device
1
>