[R] read.table without sep

Vasundhara Akkineni vasu.akkineni at gmail.com
Fri Nov 25 19:31:40 CET 2005


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.
-------------- next part --------------
14A_U133A_StatPairs	14A_U133A_Detection	14B_U133A_Signal	88A_U133A_Signal	88B_U133A_Signal	183A_U133A_Signal	183B_U133A_Signal
AFFX-BioB-5_at	403.0	409.3	611.5	569.2	536.6	580.2	
AFFX-BioB-M_at	757.3	574.4	826.7	595.3	755.2	956.0	
AFFX-BioB-3_at	284.4	327.3	421.6	336.6	391.3	412.6	
AFFX-BioC-5_at	2314.2	1685.3	2264.7	2204.1	2233.1	2458.4	
AFFX-BioC-3_at	1574.5	1273.0	1484.6	1321.2	1474.7	1774.1	
AFFX-BioDn-5_at	2333.7	1796.8	2464.5	2372.5	2095.9	2735.7	
AFFX-BioDn-3_at	13673.9	11463.9	13624.7	14513.9	12934.1	16293.1	
AFFX-CreX-5_at	17778.8	15248.8	19977.2	19613.4	18609.1	18988.2	
AFFX-CreX-3_at	31056.6	24869.9	30773.4	32918.6	34412.1	33954.6	
AFFX-DapX-5_at	36.3	69.8	92.0	52.0	57.3	64.9	
AFFX-DapX-M_at	133.4	75.1	76.2	108.9	74.0	100.2	
AFFX-DapX-3_at	10.0	11.1	84.0	9.6	9.3	9.6	
AFFX-LysX-5_at	40.4	31.1	8.3	6.6	8.6	50.0	
AFFX-LysX-M_at	12.8	16.5	65.2	67.8	13.7	39.1	
AFFX-LysX-3_at	66.1	8.6	83.5	9.4	43.9	28.7	
AFFX-PheX-5_at	14.8	17.6	9.7	14.7	15.2	19.3	
AFFX-PheX-M_at	70.6	12.4	22.8	88.0	8.0	18.5	
AFFX-PheX-3_at	33.2	97.4	31.6	31.7	129.5	11.1	
AFFX-ThrX-5_at	26.4	31.3	14.5	23.4	28.1	24.2	
AFFX-ThrX-M_at	87.4	43.9	89.4	33.0	52.4	52.8	
AFFX-ThrX-3_at	19.9	18.9	13.9	26.1	24.0	17.0	
AFFX-TrpnX-5_at	32.6	13.5	26.5	11.4	60.3	18.4	
AFFX-TrpnX-M_at	14.9	7.5	12.1	10.1	11.3	12.8	
AFFX-TrpnX-3_at	17.3	4.3	7.0	26.0	2.3	8.6	











More information about the R-help mailing list