Thank you very much Sarah.

No, just to replace the values greater than 1 in X2.

Best,

Manuel

2012/10/25 Sarah Goslee <sarah.goslee@gmail.com>

> Hi,
>
> 2012/10/25 Manuel Spínola <mspinola10@gmail.com>:
> > Dear list members,
> >
> > I want to replace the values of a numerical variable in a data frame
> called
> > "A".
> >
> > A
> > X1    X2
> > 2       1.5
> > 3        1
> > 4        1.2
> >
> > How to replace any value greater than 1 by the value 1 in the variable
> X2.
>
> I think you made a typo? I'm assuming you want to replace values in
> column X1 that are greater than 1 with the values in X2? All of your
> X1 are greater than 1 in your test example, but:
>
> with(A, ifelse(X1 > 1, X2, X1))
> or
> A$X1[A$X1 > 1] <- A$X2[A$X1 > 1]
>
>
> Sarah
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>



-- 
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspinola@una.ac.cr
mspinola10@gmail.com
Teléfono: (506) 2277-3598
Fax: (506) 2237-7036
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

	[[alternative HTML version deleted]]

