[R] read.table without sep

From: Vasundhara Akkineni <vasu.akkineni_at_gmail.com>
Date: Sat 26 Nov 2005 - 05:31:40 EST


Hello all,

I have a data file table.txt which i have attached. I am trying to pass the columns as arguments to a function "totnorm" where i am displaying a total normalization plot. The function is given below:

totnorm<-function(x,y){scale<-sum(x)/sum(y);xlab<-colnames(x);ylab<-colnames(y);x1<-x[[1]];y1<-scale*y[[1]];plot(x1,y1,xlab=xlab,ylab=ylab,col=6, col.lab=4);}

i tried doing this:

data<-read.table("alldata.txt",header=TRUE,sep="\t") a<-data[1]
b<-data[2]
totnorm(a,b)

The problem i am facing is- xlab and ylab contain the column names of data[1] and data[2], but data[1][[1]] which is assigned to x1 has different data which does not correspond to the colname(data[1]). Stating more clearly, the colnames and the coldata don't match. I tried usind read.tablewithout sep attribute, as given below:

data1<-read.table("alldata.txt",header=TRUE)

But this statement is not getting executed using Rserve when i make a connection to R and try to execute it from a java servlet. I don't know why it was doing so, so thought it would be better to fix this on R side, i.e, try to use the "sep" attribue in read.table and still make the colnames and coldata point to the same col#.

Please suggest a solution.
Thanks,
Vasu.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Nov 26 05:48:56 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:21 EST