You can also try using ifesle()

A$X2 <- ifelse(A$X2>1, 1, A$X2)

On Thu, Oct 25, 2012 at 2:08 PM, Peter Solymos <soly...@ualberta.ca> wrote:

> Maybe:
> A$X2[A$X2>1] <- 1
>
> Peter
>
> --
> Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
> soly...@ualberta.ca, Ph 780.492.8534, http://psolymos.github.com
> Alberta Biodiversity Monitoring Institute, http://www.abmi.ca
> Boreal Avian Modelling Project, http://www.borealbirds.ca
>
>
> 2012/10/25 Manuel Spínola <mspinol...@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.
> >
> > Thank you very much in advance.
> >
> > Best,
> >
> > Manuel
> >
> > --
> > *Manuel Spínola, Ph.D.*
> > Instituto Internacional en Conservación y Manejo de Vida Silvestre
> > Universidad Nacional
> > Apartado 1350-3000
> > Heredia
> > COSTA RICA
> > mspin...@una.ac.cr
> > mspinol...@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]]
> >
> >
> > _______________________________________________
> > R-sig-ecology mailing list
> > R-sig-ecology@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> >
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

Reply via email to