[R] Replacing NAs with 0 for a list of data frames
Kang Min
ngokangmin at gmail.com
Mon May 31 10:21:14 CEST 2010
Hi,
I have a list of 100 data frames, each data frame has 50 obs of 377
variables.
I would like to replace all the NAs with 0 in all the dataframes.
Should I have a for loop for every data frame?
Below is an extract of how the data looks like.
List of 100
$ :'data.frame': 50 obs. of 377 variables:
..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
..$ ACTEEX: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
..$ ACTIML: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
..$ ADENMA: int [1:50] NA NA NA 2 NA NA NA NA NA NA ...
$ :'data.frame': 50 obs. of 377 variables:
..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
..$ ACTEEX: int [1:50] NA NA NA NA 2 NA NA NA NA NA ...
..$ ACTIML: int [1:50] NA NA NA NA 1 NA NA NA NA NA ...
..$ ADENMA: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
Thanks.
Kang Min
More information about the R-help
mailing list