hey, I try to simulate some results using R.
Don't know why can't manage to display the table at the end..
Could someone help me?
thankss!
#Making data
set.seed(1)
library(stats)
#Bart Variable
helmet_bart = rnorm(n=39, mean= 40.40, sd=18.18)
cap_bart = rnorm (n=41, mean=31.06, sd= 13.19)
#Sensation seeking variable
helmet_sensa_seek = rnorm(n=39, mean=23.23, sd=7)
cap_sensa_seek = rnorm(n=41, mean=18.78, sd= 5.09)
variable_data= data.frame(bartvar= c(helmet_bart,cap_bart), sensaseekvar= c(helmet_sensa_seek, cap_sensa_seek))
#conditions
group1 = rep(1,39)
group2 = rep(2, 41)
install.packages("labelled")
library(labelled)
conditions = labelled(c(group1,group2),c("helmet"=1, "cap"=2))
data=data.frame(conditions,variable_data)
#making table
install.packages('tab')
library(tab)
resultstable= rbind(tabmeans(x=data$conditions, y=data$bartvar), tabmeans(x=data$conditions, y=data$sensaseekvar))
print(resultstable)
this is the graph I should manage to have at the end...
Thanks for your time and help