[R] Creating a zero matrix when a condition doesn´t get it

2011-07-12 Thread Trying To learn again
Hi all, I first create a matrix/data frame called d2 if another matrix accomplishes some restrictions dacc2 da2-da1[colSums(dacc2)9,] da2-da2[(da2[,13]=24),] write.csv(da2, file =paste('hggi', i,'.csv',sep = '')) The thing is if finally da2 cannot get/passs the filters, it cannot writte a csv

Re: [R] Creating a zero matrix when a condition doesn´t get it

2011-07-12 Thread Sarah Goslee
Hi, You don't provide us with a reproducible example, so I can't provide you with actual code. But two approaches come to mind: 1. Create da2 with one row and n columns, then change the appropriate elements, if any, based on your conditions. 2. Do the conditional parts, then check to see whether

Re: [R] Creating a zero matrix when a condition doesn´t get it

2011-07-12 Thread Trying To learn again
Many Thanks¡¡¡ I will try this night, I have read this I think could help me. I´m conscient the question was badly formulated now, I will try to explain better next time¡¡¡ On a side note: apply always accesses the function you use at least once. If the input is a dataframe without any rows but