[R] How to count the number of objects in a matrix?

John Kane jrkrideau at yahoo.ca
Sun Oct 21 17:20:15 CEST 2007


I think you just want length()

Does this work for you?

aa <- matrix(1:25, nrow=5)
length(aa)


--- Muri Soares <murisoares at yahoo.com> wrote:

> Hi all,
> How do you count the number of objects in a matrix?
> Sorry if it's too basic a question.
> 
> Thanks,
> 
> 
> 
> __________________________________________________
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>



More information about the R-help mailing list