view caret_regression/tool1/csv2rdatatrain.R @ 0:68300206e90d draft default tip

Uploaded
author deepakjadmin
date Thu, 05 Nov 2015 02:41:30 -0500
parents
children
line wrap: on
line source

args <- commandArgs(TRUE)
####source("/home/galaxy/galaxy-dist/tools/mpdstools/tool1/csv2rdatatrain2.R")

csv2rdatatrain <- function(arg1,arg2){ file <- read.csv(arg1,row.names =1, header=T)
  col <- ncol(file)
  stopifnot(is.null(file) | col > 2 )

  #cat("the Outcome column is not a factor vector.\n",file=stderr())
  stopifnot(is.numeric(file[,col]))

 # if(is.numeric(file[,col])  {  
    dataX <- file[,1:(col-1)]
    dataY <- file[,col]
    stopifnot(nrow(dataX) == length(dataY)) 
    save(dataX,dataY,file=arg2)
 # }else {     cat("the Outcome column has less number of entry than number of compounds.please check input file.\n",file=stderr())
  #    } 
 }

csv2rdatatrain(args[1],args[2])