[R-sig-Epi] help
BXC (Bendix Carstensen)
bxc at steno.dk
Sun Nov 28 08:17:14 CET 2010
It sounds as if you are looking for something like
newvar <- as.numeric(var1=="yes")
or
newvar <- as.numeric(var1==1)
depending on whether var1 is numeric or character.
Best regards,
Bendix Carstensen
> -----Original Message-----
> From: r-sig-epi-bounces at r-project.org
> [mailto:r-sig-epi-bounces at r-project.org] On Behalf Of Dr Khan
> Amir Maroof
> Sent: 27. november 2010 16:31
> To: r-sig-epi at stat.math.ethz.ch
> Subject: [R-sig-Epi] help
>
> Sir,
>
> Its wonderful to start using this software R. I am making
> full efforts to learn it on my own with the help of the free
> online manuals available. I am using epicalc package in R. I
> have a dataset where i want to apply conditions like... if
> var1 is yes or 1, assign 1 to it or else 0. Can you help me
> with this problem?
>
> Thanking you,
>
> --
> Dr. Khan Amir Maroof,
> Lecturer,
> Department of Community Medicine,
> University College of Medical Sciences & GTB Hospital, Delhi
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Epi at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-epi
>
More information about the R-sig-Epi
mailing list