Skip to content

Instantly share code, notes, and snippets.

@fonnesbeck
Created March 25, 2010 00:06
Show Gist options
  • Save fonnesbeck/342998 to your computer and use it in GitHub Desktop.
Save fonnesbeck/342998 to your computer and use it in GitHub Desktop.
Convert factor levels to numeric in R. Slightly more efficient than "as.numeric(as.character(f))"
as.numeric(levels(f))[f]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment