-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeOutput.R
More file actions
27 lines (25 loc) · 925 Bytes
/
makeOutput.R
File metadata and controls
27 lines (25 loc) · 925 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
makeOutput <-
function(preds, call)
{
#Data quality checks
if(!is(call,"character"))
stop("!is(fname,'character')")
if( is.matrix(preds) | is.data.frame(preds) )
stop("is.matrix(preds) | is.data.frame(preds). Ensure preds is a numeric vector!")
if(!"Submissions" %in% list.files() )
stop("No submissions directory!")
files = list.files("Submissions")
files = files[grepl("_raw", files)]
ids = as.numeric( gsub("_raw.csv", "", files) )
ids = ids[!is.na(ids)]
newId = max(ids,0)+1
write.csv(preds, paste0("Submissions/",newId,"_raw.csv"), row.names=F)
#Insert code to produce the correctly formatted output file
if("desc.csv" %in% list.files("Submissions") ){
desc = read.csv("Submissions/desc.csv", stringsAsFactors=F)
desc = rbind( desc, data.frame(newId, call) )
} else {
desc = data.frame(newId, call)
}
write.csv(desc, file="Submissions/desc.csv", row.names=F)
}