Re: [R] remove NAs from list collectively

2012-02-08 Thread Johannes Radinger
Hi, lapply(df, function (x) x[!is.na(x)]) thats is really great! Thank you! Original-Nachricht > Datum: Wed, 08 Feb 2012 12:01:17 +0100 > Von: Dimitris Rizopoulos > An: Johannes Radinger > CC: R-help@r-project.org > Betreff: Re: [R] remove NAs from list coll

Re: [R] remove NAs from list collectively

2012-02-08 Thread Dimitris Rizopoulos
Two possibilities are: lapply(df, function (x) x[!is.na(x)]) and lapply(df, na.exclude) I hope it helps. Best, Dimitris On 2/8/2012 11:54 AM, Johannes Radinger wrote: Hi, I am importing dataframe from an Excel file (xlsx package). The columns contain acutally measurements for single spec

[R] remove NAs from list collectively

2012-02-08 Thread Johannes Radinger
Hi, I am importing dataframe from an Excel file (xlsx package). The columns contain acutally measurements for single species and the column-length is of variable. As it is imported as a dataframe the difference to the "longest" column is filled with NA. To explain it with an example, my dataframe