Description Usage Arguments Details Value Author(s) See Also Examples

Map elements of a vector according to the provided 'cases'. This
function is useful for mapping discrete values to factor labels and
is the vector equivalent to the `switch`

function.

1 |

`x` |
Vector to be converted |

`...` |
Map of alternatives, specified as "name"=value |

`default` |
Value to be assigned to elements of |

This function is to `switch`

what `ifelse`

is to `if`

,
and is a convenience wrapper for `factor`

.

A factor variables with each element of `x`

mapped into the
corresponding level of specified in the mapping.

Gregory R. Warnes greg@warnes.net

1 2 3 4 5 |

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.