Mike, The output is only limited by available RAM and the maximum permissible length for vectors. And you can test it fairly easily.
vec <- sample(1:2000,10000,replace=TRUE) Dan Daniel J. Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -----Original Message----- > From: Mike Miller [mailto:mbmil...@gmail.com] On Behalf Of Mike Miller > Sent: Wednesday, December 24, 2014 12:44 PM > To: Nordlund, Dan (DSHS/RDA) > Cc: R-Help List > Subject: Re: [R] ave(x, y, FUN=length) produces character output when x > is character > > On Wed, 24 Dec 2014, Nordlund, Dan (DSHS/RDA) wrote: > > > For your character vector example, this will get you the counts. > > > > table(charvec)[charvec] > > > > Hope this is helpful, > > > It does help, Dan! I came up with the same idea and expanded on it a > bit > to work properly with other kinds of vectors: > > as.vector(table( as.character(vec) )[as.character(vec)]) > > If there are, say, 10,000 different elements in vec, each repeated an > average of 5-10 times, will this still work correctly? In other words, > the length of the table output array is unlimited, right? > > Mike ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.