[R] "sequence of factor settings"?
Christian Schulz
ozric at web.de
Fri Dec 10 09:24:15 CET 2004
Phil and Andy,
many thanks for your help's!
regrads,christian
Phil Spector wrote:
> Christian -
> Perhaps this is what you are looking for:
>
> > dat = NULL
> > for(i in 1:8)dat = cbind(dat,sample(1:5,size=100000,replace=TRUE))
> > dat = data.frame(dat)
> > tt = table(dat)
> > tt1 = data.frame(tt)
> > tt1 = tt1[order(tt1[,9],decreasing=TRUE),]
> > tt1[1:10,]
>
> Basically, converting the result from table() to a data frame
> produces a data frame with one column for each factor, and a final
> column with the counts. Reording the data frame by that final column
> orders the sequences by their frequencies.
>
> Hope this helps!
>
> - Phil Spector
> Statistical Computing Facility
> Department of Statistics
> UC Berkeley
> spector at stat.berkeley.edu
>
>
> On Thu, 9 Dec 2004, Christian Schulz wrote:
>
>> Hi,
>>
>> exist in any package a function which "work with sequences".
>>
>> Easy example 10 factors with 2 levels, are if i'm
>> correct theoretical 2^10 "sequences" possible.
>>
>> But i have more than 2 levels and perhaps more than 10 factors and
>> interested for the top10 "sequence's"
>> with higehest freqs and wish to know which type of sequence it is.
>>
>> Many thanks for a starting point
>> Christian
>>
>> ______________________________________________
>> 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