Ok Josh. Many thanks for your effort.
Ashim : )
On Mon, Jul 18, 2011 at 1:34 PM, Joshua Wiley wrote:
> On Mon, Jul 18, 2011 at 12:22 AM, Ashim Kapoor
> wrote:
> > ttt <- data.frame(A = c(Inf, 0, 0), B = c(1, 2, 3))
> >>
> >> apply(ttt, 2, function(x) {x[is.infinite(x)] <- 0; x})
> >>
> >
>
On Mon, Jul 18, 2011 at 12:22 AM, Ashim Kapoor wrote:
> ttt <- data.frame(A = c(Inf, 0, 0), B = c(1, 2, 3))
>>
>> apply(ttt, 2, function(x) {x[is.infinite(x)] <- 0; x})
>>
>
> Ok thank you. That does work. What does
>
> apply(ttt, 1, function(x) x[is.infinite(x)] <- 0 )
>
> this return. I get
ttt <- data.frame(A = c(Inf, 0, 0), B = c(1, 2, 3))
> apply(ttt, 2, function(x) {x[is.infinite(x)] <- 0; x})
>
>
Ok thank you. That does work. What does
apply(ttt, 1, function(x) x[is.infinite(x)] <- 0 )
this return. I get all 0's,but can you explai why ?
Thank you.
Ashim
[[alterna
Hi,
A slight modification corrects this:
ttt <- data.frame(A = c(Inf, 0, 0), B = c(1, 2, 3))
apply(ttt, 2, function(x) {x[is.infinite(x)] <- 0; x})
and please do use spaces in your code. It is much more legible. Most
notably spaces are after commas.
Cheers,
Josh
On Sun, Jul 17, 2011 at 10:0
Dear David,
Many thanks for your reply.
On Fri, Jul 15, 2011 at 5:24 PM, David Winsemius wrote:
>
> On Jul 15, 2011, at 5:20 AM, Ashim Kapoor wrote:
>
> Dear R helpers,
>>
>>
>> Please have a look at the following : -
>>
>> Note : My goal is to find and replace all Inf's in a data array with 0.
On Jul 15, 2011, at 5:20 AM, Ashim Kapoor wrote:
Dear R helpers,
Please have a look at the following : -
Note : My goal is to find and replace all Inf's in a data array with
0.
t<-data.frame(A=c(Inf,0,0),B=c(1,2,3))
t
A B
1 Inf 1
2 0 2
3 0 3
str(t)
'data.frame':3 obs. of
Dear R helpers,
Please have a look at the following : -
Note : My goal is to find and replace all Inf's in a data array with 0.
> t<-data.frame(A=c(Inf,0,0),B=c(1,2,3))
> t
A B
1 Inf 1
2 0 2
3 0 3
>str(t)
'data.frame':3 obs. of 2 variables:
$ A: num Inf 0 0
$ B: num 1 2 3
> t[
7 matches
Mail list logo