mw.freqsel {ldsa} | R Documentation |

## ~~function to do ... ~~

### Description

~~ A concise (1-5 lines) description of what the function does. ~~

### Usage

mw.freqsel(y, n, freqcount = FALSE)

### Arguments

`y` |
~~Describe `y` here~~ |

`n` |
~~Describe `n` here~~ |

`freqcount` |
~~Describe `freqcount` here~~ |

### Details

~~ If necessary, more details than the description above ~~

### Value

~Describe the value returned
If it is a LIST, use

`comp1 ` |
Description of 'comp1' |

`comp2 ` |
Description of 'comp2' |

...

### Warning

....

### Note

~~further notes~~

~Make other sections like Warning with section{Warning }{....} ~

### Author(s)

~~who you are~~

### References

~put references to the literature/web site here ~

### See Also

~~objects to See Also as `help`

, ~~~

### Examples

##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function(y,n,freqcount=FALSE){
#Create a function to calculate binary values
bv<-function(x)
sum(2^(1:length(x)-1)*x)
#If the frequencies are already present, this is quite trivial
if(freqcount){
y[rev(order(y[,NCOL(y)])),][1:n,-NCOL(y)] #Return the top n patterns
}else{ #Otherwise, we have to do some actual work
y<-cbind(y,apply(y,1,bv)) #Compute binary values for all sequences
y<-y[order(y[,NCOL(y)]),] #Sort columns into ascending order
frq<-as.vector(table(y[,NCOL(y)])) #Build a frequency vector
y<-y[!duplicated(y[,NCOL(y)]),] #Remove duplicates
y<-cbind(y,frq) #Append the frequencies (which are ordered by bv)
y[rev(order(y[,NCOL(y)])),][1:n,1:(NCOL(y)-2)] #Return the top n patterns
}
}

[Package

*ldsa* version 0.1-2

Index]