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

K. Elo maillists at nic.fi
Fri Feb 19 07:36:14 CET 2010


Dear Anna,

19.02.2010 08:17, Anna Carter wrote:
> (1) If the dataset contains some variables having all the entries = 0
> and while analysing I want to delete those pericular columns, how do
> acheive this. i.e.

Let's suppose 'df' is your data frame, then:

subset(df, select=which(colSums(df)!=0))

should do the work :)

HTH,
Kimmo



More information about the R-help mailing list