Like `cut`

, turn a vector of numbers into a factor

1 2 |

`x` |
a numeric vector |

`intervals` |
a character vector of intervals |

`buckets` |
a character vector of levels for the new factor
these have a 1-1 correspondence with |

`na.bucket` |
what level should NA values be given? |

`unmatched.bucket` |
what level should numbers not covered by an interval be given? |

`out.as.factor` |
default is TRUE Should the resulting vector be a factor? If FALSE will return a character vector. |

`...` |
These take the form |

1 2 3 4 5 6 7 8 9 10 11 | ```
fancycut(-10:10, c('(0,2]','(2,5)','[5,10]'), c('Small','Medium','Large'))
fancycut(-10:10, c('[0,0]','(0,2]','(2,5)','[5,10]'), c('Zero','Small','Medium','Large'))
fancycut(
x = -10:10,
Zero = 0,
Small = '(0,2]',
Medium = '(2,5)',
Large = '[5,10]'
)
fancycut(-10:10, c('(0,2]','(2,5)','[5,10]'), c('Small','Medium','Large'))
fancycut(-10:10, c('[0,0]','(0,2]','(2,5)','[5,10]'), c('Zero','Small','Medium','Large'))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.