[R-sig-eco] Replacing values in a data frame

Peter Solymos solymos at ualberta.ca
Thu Oct 25 21:08:10 CEST 2012


Maybe:
A$X2[A$X2>1] <- 1

Peter

--
Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
solymos at 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 <mspinola10 at 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
> mspinola at una.ac.cr
> mspinola10 at 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 at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



More information about the R-sig-ecology mailing list