[R] Export csv data

From: Keizer_71 <christophe.lo_at_gmail.com>
Date: Tue, 04 Mar 2008 00:56:54 -0800 (PST)

Hi Everyone,

Thanks for all the help with the previous queries.

Here is what i want to do. i have 20000 probesets-->calculate all the variance accross all the probesets-->filter out probesets that are low so now i ended up with only 10000. The 10000 is fine but when i export to excel, it is missing the probeID. Here are my code and examples.

#########calculate the variance across the probesets and plot
signals#########

library(xlsReadWrite)

x<-1:20000
y<-2:141
data.matrix<-data.matrix(data[,y])#create data.matrix variableprobe<-apply(data.matrix[x,],1,var) variableprobe #output variance across probesets hist(variableprobe) #displaying histogram of variableprobe write.xls(cbind(data[1],
Variance=apply(data[,y],1,var)),file='c://variance.csv')
#export as a .csv file.

Output:

ProbeID	             Variance
224588_at	21.58257457



##############################################################################
#############filter out low variance and Select 10,000
probesets##############

data.sub = data.matrix[order(variableprobe,decreasing=TRUE),][1:10000,] dim(data.sub)

write.table(data.sub, file = "c://data_output.csv", sep = ",", col.names = NA)

Output:

	Sample_1_D	Sample_1_C	Sample_2_D	Sample_2_C
1	2.425509867	11.34031409	11.46868531	11.75741478


what i need is this

        ProbeID Sample_1_D Sample_1_C Sample_2_D Sample_2_C
1 224588_at 2.425509867 11.34031409 11.46868531 11.75741478

This is just the short version but there are 10000 rows and 140 columns.

thanks

-- 
View this message in context: http://www.nabble.com/Export-csv-data-tp15822903p15822903.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 04 Mar 2008 - 08:59:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 04 Mar 2008 - 11:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive