[R] What does "rbind(iris[,,1], iris[,,2], iris[,,3])" do?

Gabor Grothendieck ggrothendieck at gmail.com
Thu Apr 13 14:01:36 CEST 2006


What you are referring to iris is called iris3 in R so just replace
iris with iris3.   iris3 is a 3d array in R whereas iris is a data frame.

On 4/13/06, Sasha Pustota <popgen at gmail.com> wrote:
> It's in the Venables & Ripley MASS (ed 3) book in the section on
> principal components.
> The context is as follows
>
> > ir <- rbind(iris[,,1], iris[,,2], iris[,,3])
> > ir.species <- factor(c(rep("s",50),rep("c",50),rep("v",50)))
> (then they use brush(ir) which I guess is not an R function)
>
> and then
>
> > princomp(log(ir[1:4]),cor=T)
> (there is no [1:4] in the text which is probably a typo)
>
> >From what I can see,
>
> > iris[,,1]
>
> is the same as
>
> > iris
>
> and "rbind(iris[,,1], iris[,,2], iris[,,3])" duplicates iris 3 times
> while "mangling" the row index. What happens to the index and what is
> the purpose of that?
>
> I also seem to get the same result with "rbind(iris[,,1], iris[,,1],
> iris[,,1])". What is the difference with "rbind(iris[,,1], iris[,,2],
> iris[,,3])"?
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list