How can I convert list to vector in R here?
a1 <- matrix(rcauchy(10*200, 0, 1), 200)
for (i in 1:150) {
if (shapiro.test(a1[i,])$p.value >= 0.05) {
print(t.test(a1[i,], alternative = "two.sided")$p.value)
}
}
I use this code but I get only the first value
p <- NULL
for (i in 1:150) {
p[i] <- if (shapiro.test(a1[i,])$p.value>=0.05) {
(t.test(a1[i,], alternative = "two.sided")$p.value)
}
}
p