Created
August 3, 2012 17:58
-
-
Save gsk3/3250007 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Obtain the fractional part of a numeric | |
#' | |
#' Takes a numeric vector and returns a vector of the numbers after the decimal | |
#' place | |
#' | |
#' @param vec A numeric vector of any length | |
#' @return A vector of the same length as the input vec containing only the decimal component. | |
#' @examples | |
#' x <- runif(100) | |
#' fpart(x) | |
#' | |
fpart = function(vec) { | |
ret = vec - as.integer(vec) | |
ret | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment