Skip to content
Prev 17950 / 398503 Next

apply problem

On Sat, 16 Mar 2002 ggrothendieck at yifan.net wrote:

            
Not a good choice of name: iris3 is another R dataset.

Your iris3 is a data frame.
You are not using array as documented. ?apply says

Arguments:

       X: the array to be used.


iris3 is not an array, so it it coerced to one via as.matrix
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 "5.1"        "3.5"       "1.4"        "0.2"       "setosa"
2 "4.9"        "3.0"       "1.4"        "0.2"       "setosa"
3 "4.7"        "3.2"       "1.3"        "0.2"       "setosa"

and that's not the same object as your iris3