[R] replacing values in vector
Dimitris Rizopoulos
dimitris.rizopoulos at med.kuleuven.ac.be
Tue Sep 28 11:35:29 CEST 2004
just use
v1[v1==0] <- 1
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/396887
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
----- Original Message -----
From: <pbrouilly at gphy.campus.univ-poitiers.fr>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, September 28, 2004 11:09 AM
Subject: [R] replacing values in vector
> Hi everybody !!
>
> I have a vector named v1 with a lot of values from 0 to 10.
> Is there a solution to replace all 0 by 1 ??
>
> I have tried with a 'FOR' loop...
>
> Thank you very much
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list