if(!requireNamespace('lattice', quietly = TRUE)){ install.packages('lattice', dependencies=TRUE, repos='http://cran.rstudio.com/') } library(lattice) source('../../Data/get_balance_data.R') DF = get_balance_data() ## For Forward_N_Backwards: ## x=DF[DF$Age_Group=='elderly', 'Forward_N_Backward' ] y=DF[DF$Age_Group=='young', 'Forward_N_Backward' ] res = t.test(x, y) print(res) histogram(~ Forward_N_Backward | Age_Group, layout=c(1, 2), data=DF, n=10) ## For Side_to_Side: ## x=DF[DF$Age_Group=='elderly', 'Side_to_Side'] y=DF[DF$Age_Group=='young', 'Side_to_Side'] res = t.test(x, y) print(res) histogram(~ Side_to_Side | Age_Group, layout=c(1, 2), data=DF, n=10) # Form the avarage of the two times: # DF$Avg = 0.5 * ( DF$Forward_N_Backward + DF$Side_to_Side ) x=DF[DF$Age_Group=='elderly', 'Avg'] y=DF[DF$Age_Group=='young', 'Avg'] res = t.test(x, y) print(res) histogram(~ Avg | Age_Group, layout=c(1, 2), data=DF, n=10)