as_numeric2 | R Documentation |
Wrapper for as.numeric that works the same as as.numeric for everything except factors for which it returns the levels of the factor (if it can), rather than the underlying integers
as_numeric2(x)
x |
vector to convert to double. |
Should work fine as the only (base) methods for as.numeric are difftime and POSIXlt which don't also have factor as class. Could be problematic if some class inherits factor, but then provides their own as.numeric method, which this function would override. could of course get function to check for this and to avoid, but think it is very unlikely.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.