[R] Export csv data
Keizer_71
christophe.lo at gmail.com
Tue Mar 4 09:56:54 CET 2008
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.
More information about the R-help
mailing list