Dear K. Elo,
You're right!
cimfasy_rwl=read.table(textConnection("1991 0.92 0.72 0.50
1.29 0.54 1.22
1992 2.15 1.28 1.23 2.26 1.22 3.17
1993 1.50 0.87 1.68 1.97 0.83 2.55
1994 0.69 0.00 0.76 1.89 0.60 0.87
1995 1.13 1.04 1.19 1.52 1.13 1.78
1996 1.15 0.92 1.50 0.97 0.60 NA
1997 NA NA NA NA NA NA
1998 NA NA NA NA NA NA
1999 NA NA NA NA NA NA
2000 NA NA NA NA NA
NA"),sep="",header=FALSE)
cimfasy_rwl[is.na(cimfasy_rwl)]<-0
cimfasy_rwl
V1 V2 V3 V4 V5 V6 V7
1 1991 0.92 0.72 0.50 1.29 0.54 1.22
2 1992 2.15 1.28 1.23 2.26 1.22 3.17
3 1993 1.50 0.87 1.68 1.97 0.83 2.55
4 1994 0.69 0.00 0.76 1.89 0.60 0.87
5 1995 1.13 1.04 1.19 1.52 1.13 1.78
6 1996 1.15 0.92 1.50 0.97 0.60 0.00
7 1997 0.00 0.00 0.00 0.00 0.00 0.00
8 1998 0.00 0.00 0.00 0.00 0.00 0.00
9 1999 0.00 0.00 0.00 0.00 0.00 0.00
10 2000 0.00 0.00 0.00 0.00 0.00 0.00
HTH,
Jorge
On Fri, Jun 27, 2008 at 11:13 AM, K. Elo <[EMAIL PROTECTED]> wrote:
> Hi,
>
> cimfasy_rwl[ is.na(cimfasy_rwl) ] <-0
>
> Or did I understood Your right?
>
> HTH,
> Kimmo
>
>
>
> Alfredo Alessandrini wrote:
>
>> I'm trying to replace NA with 0 value...
>>
>> I've write a loop, but don't work...
>>
>> Where's the problem?
>>
>>
>> cimfasy_rwl
>>>
>> 1991 0.92 0.72 0.50 1.29 0.54 1.22
>> 1992 2.15 1.28 1.23 2.26 1.22 3.17
>> 1993 1.50 0.87 1.68 1.97 0.83 2.55
>> 1994 0.69 0.00 0.76 1.89 0.60 0.87
>> 1995 1.13 1.04 1.19 1.52 1.13 1.78
>> 1996 1.15 0.92 1.50 0.97 0.60 NA
>> 1997 NA NA NA NA NA NA
>> 1998 NA NA NA NA NA NA
>> 1999 NA NA NA NA NA NA
>> 2000 NA NA NA NA NA NA
>>
>>> files_rwl <- ls(pattern="_rwl$")
>>> files_rwl
>>>
>> [1] "cimfasy_rwl" "rocquce_rwl"
>>
>>> for (i in files_rwl) assign(i,i[is.na(i)] <- 0)
>>> ls()
>>>
>> [1] "cimfasy_rwl" "files_rwl" "files.rwl" "i" "rocquce_rwl"
>>
>>> cimfasy_rwl
>>>
>> [1] 0
>>
>>
>> Thanks in advance,
>>
>> Alfredo
>>
>> ______________________________________________
>> [email protected] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.