Here's my code
pulse <- round(rnorm(22, 70, 10 / 3)) + rep(c(0, 5), c(10, 12))
group <- rep(c("A", "B"), c(10, 12))
tapply(pulse, group, length)
A B
10 12
list<-split(pulse,group)
sapply(list,length)
A B
10 12
identical(tapply(pulse, group, length),sapply(list,length))#FALSE
identical(tapply(pulse, group, length),as.table(sapply(list,length)))#FALSE
identical(tapply(pulse, group, length),as.vector(sapply(list,length)))#FALSE
identical(as.table(tapply(pulse, group, length)),as.table(sapply(list,length)))#TRUE
These two functions generate same results, but why they are not identical? I used typeof() in R, it seems that both of the results with the type "double".
Why identical(tapply(pulse, group, length),sapply(list,length)) is False? How to adjust my code to make them identical?
Thank you.