diff --git a/README.Rmd b/README.Rmd index d0b70f2..b851ebb 100644 --- a/README.Rmd +++ b/README.Rmd @@ -14,7 +14,7 @@ verbad <- sprintf(' [![Coverage Status](https://coveralls.io/repos/trinker/qdapTools/badge.svg)](https://coveralls.io/r/trinker/qdapTools) [![DOI](https://zenodo.org/badge/5398/trinker/qdapTools.svg)](http://dx.doi.org/10.5281/zenodo.11117) `r verbad` - +[![](http://cranlogs.r-pkg.org/badges/qdapTools)](http://cran.rstudio.com/web/packages/qdapTools/index.html) ![qdapicon](https://dl.dropbox.com/u/61803503/qdapicon.png) diff --git a/README.md b/README.md index 67e1112..9faca58 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ [![Build Status](https://travis-ci.org/trinker/qdapTools.svg?branch=master)](https://travis-ci.org/trinker/qdapTools) [![Coverage Status](https://coveralls.io/repos/trinker/qdapTools/badge.svg)](https://coveralls.io/r/trinker/qdapTools) [![DOI](https://zenodo.org/badge/5398/trinker/qdapTools.svg)](http://dx.doi.org/10.5281/zenodo.11117) -
- + +[![](http://cranlogs.r-pkg.org/badges/qdapTools)](http://cran.rstudio.com/web/packages/qdapTools/index.html) ![qdapicon](https://dl.dropbox.com/u/61803503/qdapicon.png) diff --git a/inst/web/Deprecated.html b/inst/web/Deprecated.html index 7127a3a..b4a4650 100644 --- a/inst/web/Deprecated.html +++ b/inst/web/Deprecated.html @@ -2,7 +2,7 @@ -run_split
shift
shift_left
shift_right
split_vector
run_split
,
+split_vector
https://github.com/trinker/loc_split_example for practical usage.
-Other split.functions: run_split
;
- split_vector
-
vector
, list
, or
+data.frame
of named/unnamed vectors.data.frame
with columns equal to
+number of unique elements and the number of rows equal to the the original
+length of the vector
, list
, or
+data.frame
(length equals ncols in
+data.frame
). If list of vectors is named
these will be the rownames of the dataframe.
A wrapper for tabulate
that works on multiple vectors.
Similar to tabulate
that works on multiple vectors.
Splits a string into a vector or runs.
+Splits a string into a vector of runs.
loc_split
,
- loc_split.character
,
- loc_split.data.frame
,
- loc_split.default
,
- loc_split.factor
,
- loc_split.list
,
- loc_split.matrix
,
- loc_split.numeric
;
- split_vector
+loc_split
,
+split_vector
+ +shift(x, n, direction = "right")+shift_right(x, n)+shift_left(x, n)
shift_right
and
+shift_left
for better performance.Shift a vector left or right n spaces.
+ ++lapply(0:9, function(i) shift(1:10, i)) ++[[1]] + [1] 1 2 3 4 5 6 7 8 9 10 + +[[2]] + [1] 2 3 4 5 6 7 8 9 10 1 + +[[3]] + [1] 3 4 5 6 7 8 9 10 1 2 + +[[4]] + [1] 4 5 6 7 8 9 10 1 2 3 + +[[5]] + [1] 5 6 7 8 9 10 1 2 3 4 + +[[6]] + [1] 6 7 8 9 10 1 2 3 4 5 + +[[7]] + [1] 7 8 9 10 1 2 3 4 5 6 + +[[8]] + [1] 8 9 10 1 2 3 4 5 6 7 + +[[9]] + [1] 9 10 1 2 3 4 5 6 7 8 + +[[10]] + [1] 10 1 2 3 4 5 6 7 8 9 + ++lapply(0:9, function(i) shift(1:10, i, "left")) ++[[1]] + [1] 1 2 3 4 5 6 7 8 9 10 + +[[2]] + [1] 10 1 2 3 4 5 6 7 8 9 + +[[3]] + [1] 9 10 1 2 3 4 5 6 7 8 + +[[4]] + [1] 8 9 10 1 2 3 4 5 6 7 + +[[5]] + [1] 7 8 9 10 1 2 3 4 5 6 + +[[6]] + [1] 6 7 8 9 10 1 2 3 4 5 + +[[7]] + [1] 5 6 7 8 9 10 1 2 3 4 + +[[8]] + [1] 4 5 6 7 8 9 10 1 2 3 + +[[9]] + [1] 3 4 5 6 7 8 9 10 1 2 + +[[10]] + [1] 2 3 4 5 6 7 8 9 10 1 + +++## Explicit, faster shifting +lapply(0:9, function(i) shift_right(1:10, i)) ++[[1]] + [1] 1 2 3 4 5 6 7 8 9 10 + +[[2]] + [1] 2 3 4 5 6 7 8 9 10 1 + +[[3]] + [1] 3 4 5 6 7 8 9 10 1 2 + +[[4]] + [1] 4 5 6 7 8 9 10 1 2 3 + +[[5]] + [1] 5 6 7 8 9 10 1 2 3 4 + +[[6]] + [1] 6 7 8 9 10 1 2 3 4 5 + +[[7]] + [1] 7 8 9 10 1 2 3 4 5 6 + +[[8]] + [1] 8 9 10 1 2 3 4 5 6 7 + +[[9]] + [1] 9 10 1 2 3 4 5 6 7 8 + +[[10]] + [1] 10 1 2 3 4 5 6 7 8 9 + ++lapply(0:9, function(i) shift_left(1:10, i)) ++[[1]] + [1] 1 2 3 4 5 6 7 8 9 10 + +[[2]] + [1] 10 1 2 3 4 5 6 7 8 9 + +[[3]] + [1] 9 10 1 2 3 4 5 6 7 8 + +[[4]] + [1] 8 9 10 1 2 3 4 5 6 7 + +[[5]] + [1] 7 8 9 10 1 2 3 4 5 6 + +[[6]] + [1] 6 7 8 9 10 1 2 3 4 5 + +[[7]] + [1] 5 6 7 8 9 10 1 2 3 4 + +[[8]] + [1] 4 5 6 7 8 9 10 1 2 3 + +[[9]] + [1] 3 4 5 6 7 8 9 10 1 2 + +[[10]] + [1] 2 3 4 5 6 7 8 9 10 1 + ++lapply(0:25, function(i) shift_left(LETTERS, i)) ++[[1]] + [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" + +[[2]] + [1] "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" + +[[3]] + [1] "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" + +[[4]] + [1] "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" + +[[5]] + [1] "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" + +[[6]] + [1] "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" + +[[7]] + [1] "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" + +[[8]] + [1] "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" + +[[9]] + [1] "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" + +[[10]] + [1] "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" + +[[11]] + [1] "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" + +[[12]] + [1] "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" + +[[13]] + [1] "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" + +[[14]] + [1] "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" + +[[15]] + [1] "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" + +[[16]] + [1] "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" + +[[17]] + [1] "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" + +[[18]] + [1] "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" "I" + +[[19]] + [1] "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" "H" + +[[20]] + [1] "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" + +[[21]] + [1] "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" "F" + +[[22]] + [1] "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" "E" + +[[23]] + [1] "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" "D" + +[[24]] + [1] "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" "C" + +[[25]] + [1] "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" "B" + +[[26]] + [1] "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A" + +
loc_split
,
- loc_split.character
,
- loc_split.data.frame
,
- loc_split.default
,
- loc_split.factor
,
- loc_split.list
,
- loc_split.matrix
,
- loc_split.numeric
; run_split
+loc_split
,
+run_split