-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathscoresum.r
More file actions
38 lines (22 loc) · 771 Bytes
/
scoresum.r
File metadata and controls
38 lines (22 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env Rscript
library("optparse")
option_list = list(
make_option(c("-f", "--file"), type="character", default=NULL,
help="dataset file name", metavar="character"),
make_option(c("-o", "--out"), type="character", default="out.csv",
help="output file name [default= %default]", metavar="character")
);
opt_parser = OptionParser(option_list=option_list);
opt = parse_args(opt_parser);
if (is.null(opt$file)){
print_help(opt_parser)
stop("At least one argument must be supplied (input file).n", call.=FALSE)
}
score1=read.csv(opt$file, sep=",", header=F)
df=data.frame()
for (i in (1:60)){
line=c(i, sum(score1$V2>i)) # note the ratio position
df=rbind(df, line)
}
colnames(df)=c("no", opt$file)
write.csv(df, file=opt$out, row.names=FALSE)