comparison csv2rdata.R @ 0:49d7eb9e1092 draft default tip

planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
author anmoljh
date Thu, 31 May 2018 11:40:01 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:49d7eb9e1092
1 args <- commandArgs(TRUE)
2
3 csv2rdatatrain <- function(arg1,arg2)
4 {
5 file <- read.csv(arg1,row.names =1, header=T)
6 col <- ncol(file)
7 stopifnot(is.null(file) | col > 2 )
8
9 #cat("the Outcome column is not a factor vector.\n",file=stderr())
10 stopifnot(is.factor(file[,col]))
11
12 if(levels(file[,col])[1] != ""){
13 dataX <- file[,1:(col-1)]
14 dataY <- file[,col]
15 stopifnot(nrow(dataX) == length(dataY))
16 save(dataX,dataY,file=arg2)
17 }
18 else{
19 cat("the Outcome column has less number of entry than number of compounds.please check input file.\n",file=stderr())
20 }
21 }
22
23 csv2rdatatrain(args[1],args[2])
24
25
26
27
28