I am new to R programming. I am facing issues which solving this:
Dataset:
set.seed(897)
ME <- matrix(rnorm(24000),nrow=1000)
colnames(ME) <- c(paste("A",1:12,sep=""),paste("B",1:12,sep=""))
Use apply() to calculate a statistical test for every row in ME. You want to ask whether the groups A and B are from the same population or from populations with different means. You can assume data to be normally distributed. Count the number of rows with a p-value equal to, or lower than 0.05.
I tried
>P<- apply(ME , 1 , function(ME){ t.test(ME[1:1000])$p.value })
> length(which(P <= 0.05))
frown emoticon but this is incorrect