An implementation of permutation tests in R, supporting both exact and asymptotic K sample test of data locations. The p value of exact tests is found using tree algorithms. Tree algorithms treat permutations of input data as tree nodes and perform constraint depth-first searches for permutations that fall into the critical region of a test systematically. Pruning of tree search and optimisations at C level enable exact tests for certain large data sets.