[R-SIG-Mac] ifelse script
Jose G Conde Santiago
jose.conde1 at upr.edu
Wed Oct 25 19:18:21 CEST 2017
Hello.
I got one new variable computed using ifelse through R Commander. The variable was created without a problem. This was the expression to compute:
ifelse(icdfrrcond1 == 1 | icdfrrcond2 == 1 | icdfrrcond3 == 1 | icdfrrcond4 == 1 | icdfrrcond5 == 1 | icdfrrcond6 == 1 | icdfrrcond7 == 1 | icdfrrcond8 == 1 | icdfrrcond9 == 1 | icdfrrcond10 == 1 | icdfrrcond11 == 1 | icdfrrcond12 == 1 | icdfrrcond13 == 1 | icdfrrcond14 == 1 | icdfrrcond15 == 1 | icdfrrcond16 == 1 | icdfrrcond17 == 1 | icdfrrcond18 == 1 | icdfrrcond19 == 1 | icdfrrcond20 == 1, icdfrischhrtdis <- 1, icdfrischhrtdis <- 0)
This is the script generated by R Commander:
mortprres0515sle$icdfrischhrtdis <- with(mortprres0515sle, ifelse(icdfrrcond1 == 1 | icdfrrcond2 == 1 | icdfrrcond3 == 1 | icdfrrcond4 == 1 | icdfrrcond5 == 1 | icdfrrcond6 == 1 | icdfrrcond7 == 1 | icdfrrcond8 == 1 | icdfrrcond9 == 1 | icdfrrcond10 == 1 | icdfrrcond11 == 1 | icdfrrcond12 == 1 | icdfrrcond13 == 1 | icdfrrcond14 == 1 | icdfrrcond15 == 1 | icdfrrcond16 == 1 | icdfrrcond17 == 1 | icdfrrcond18 == 1 | icdfrrcond19 == 1 | icdfrrcond20 == 1, icdfrischhrtdis <- 1, icdfrischhrtdis <- 0))
When I try to run this same script from RStudio or the R console, the script is read, but the variable is not created. Even if I highlight the script in R Commander and “Submit” it, I get the same problem.
What I would like to do is to copy the script and modify it, so I can create 10 additional variables using just one script that I can run directly in R or RStudio.
Thanks.
José
José G. Conde, MD, MPH
Professor, School of Medicine
Director, CentIT2
UPR Medical Sciences Campus
Tel (787) 763-9401 Fax (787) 758-5206
Email: jose.conde1 at upr.edu
URL: http://rcmi.rcm.upr.edu
More information about the R-SIG-Mac
mailing list