Last active
August 29, 2015 14:04
-
-
Save ciela/0027c9cdabc809e0d6c7 to your computer and use it in GitHub Desktop.
度数分布的なCSVファイルからヒストグラム表示用のベクトルを取得する
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
freq.vec <- function(csv, xs = 0, xe = 0) { | |
d <- read.csv(csv) | |
vars <- d[[1]] | |
# if default, apply min and max of vars | |
xs <- ifelse(xs == 0, min(vars), xs) | |
xe <- ifelse(xe == 0, max(vars), xe) | |
d.ext <- d[vars >= xs & vars <= xe, ] | |
rep(d.ext[[1]], d.ext[[2]]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment