Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

chunkReOrder

Chunk re-order a vector so that specified newstart is first.


Description

Different than relevel.

Usage

chunkReOrder(x, newstart = x[[1]])

Examples

# Typical use-case
# chunkReOrder(1:10, 5)
# # Default is to not modify the vector
# chunkReOrder(1:10)
# # Another example not starting at 1
# chunkReOrder(10:25, 22)
# # Should silently ignore the second element of `newstart`
# chunkReOrder(10:25, c(22, 11))
# # Should be able to handle `newstart` being the first argument already
# # without duplicating the first element at the end of `x`
# chunkReOrder(10:25, 10)
# all(chunkReOrder(10:25, 10) == 10:25)
# # This is also the default
# all(chunkReOrder(10:25) == 10:25)
# # An example with characters
# chunkReOrder(LETTERS, "G") 
# chunkReOrder(LETTERS, "B") 
# chunkReOrder(LETTERS, "Z") 
# # What about when `newstart` is not in `x`? Return x as-is, throw warning.
# chunkReOrder(LETTERS, "g")

phyloseq

Handling and analysis of high-throughput microbiome census data

v1.34.0
AGPL-3
Authors
Paul J. McMurdie <joey711@gmail.com>, Susan Holmes <susan@stat.stanford.edu>, with contributions from Gregory Jordan and Scott Chamberlain
Initial release
2019-04-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.