Several functions were written the first two days to record some of the things that were harvested inside.
The function Str_comb, which is used to enter a string or a numeric vector, returns all combinations of the non-repeating lengths of elements in the vector that are less than the length of the vector, and the results are output in matrix form.
The function uses the following result:
The idea is simple, in R there is a function combn function, can produce a specified vector in the composition of the specified length of the composition, the function is to put these combinations together, so the focus is COMBN function and loop.
But finally a more empty value, should be a stop condition out of some trouble, but I did not see it, someone willing to teach the best.
Some of the R foundations involved are:
1, choose function: Choose (x, y), the permutation of the combination of C (×, y), from the X elements of any number of Y elements of a subset, only return numeric values.
2, Combn function: Combn (x, y), × vector, Y is the length of the random combination, as follows:
3. Break statement for Interrupt loop.
4. Column-by-row combination of data frames (Cbind function)
5. Load r function File: source function
6. Load history and Data: Historical function and load function,
7. Paste Function: Character combination function
8, Ncol and Nrow functions: Returns the number of columns and rows
R-Language custom functions-character combinations