[R] Deleting colmuns with 0's and also writing multple csv files

DarioAustralia D.Strbenac at garvan.org.au
Fri Feb 19 07:46:49 CET 2010


Hi Anna,

A column with all 0s will have a column sum of zero. So do this :

dataset1[, which(colSums(dataSet1 > 0))]

If you have a list of data.frames you could do this

for(index in 1:10)
{
        write.csv(yourListOfTables[[index]], file = paste("Dataset", index,
".csv", sep = ""), row.names = FALSE)
}

- Dario.
-- 
View this message in context: http://n4.nabble.com/Deleting-colmuns-with-0-s-and-also-writing-multple-csv-files-tp1561219p1561231.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list