search for: 294461

Displaying 1 result from an estimated 1 matches for "294461".

Did you mean: 29441
2005 Nov 10
7
different functions on different vector subsets
Hi, I am trying to apply two different functions on on a vector as follow: a<-c(NA,1,2,3,-3,-4,-6) if a>0 I would like to raise it by the power of 2: 2^a and if the a<0 I would like to have the inverse value, i.e., -1/2^a. so I thought of doing it two steps: a[a>0]<-2^[a>0] a[a<0]<-(-1)/2^a[a<0] I got the following error Error: NAs are not allowed in subscripted