Here is part of my sample. Please assume that I have more than 12 ds
dat<-read.table (text=" d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12
100 100 60 50 100 100 20 60 100 100 100 20
75 75 60 50 75 75 20 100 75 75 75 20
75 40 60 50 41 41 20 100 75 75 75 75
78 49 60 50 45 41 20 100 75 75 75 75
75 50 60 50 50 48 20 60 75 75 75 75
75 48 60 50 44 49 20 40 10 75 75 10
20 10 60 50 100 100 20 100 100 100 100 20
75 75 60 50 75 75 20 50 75 39 75 10
75 75 60 50 75 75 20 90 75 75 75 40
22 10 60 50 75 75 20 90 75 10 75 10
", header=TRUE)
I want to get this table within the loop.
D sd
d1 25.44711
d2 29.01647
d3 0
d4 0
d5 22.11586
d6 22.26831
d7 0
d8 23.78141
d9 24.61368
d10 26.89672
d11 10.54093
d12 28.62109
The loop is:
for(i in seq_along(dat)) {
k<- dat[[i]]
if(class(k) %in% c("numeric", "integer"))
print(sd(k))
else print("F")
}