Calculate mean value of two objects
问题 Let's say we have two objects at the beginning: a <- c(2,4,6) b <- 8 If we apply the mean() function in each of them we get this: > mean(a) [1] 4 > mean(b) [1] 8 ... which is absolutely normal. If I create a new object merging a and b... c <- c(2,4,6,8) and calculate its mean... > mean(c) [1] 5 ... we get 5, which is the expected value. However, I would like to calculate the mean value of both objects at the same time. I tried this way: > mean(a,b) [1] 4 As we can see, its value differs from