-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
project.org] On Behalf Of Yanyuan Zhu
Sent: Thursday, December 20, 2012 7:48 AM
To: r-help at r-project.org
Subject: [R] an entry level (stupid) question
Hello all, i'm a newbie to R and now I get stuck by the question, would
anybody help me please?
Suppose, I got the following
test <- data.frame(test1=c(c(0.00, 0.005, 0.01, 0.015, 0.02)))
test
test1
1 0.000
2 0.005
3 0.010
4 0.015
5 0.020
Now I want another column inside test, named test2
for i=c(1:5), If test$test1[i] is 0, then the value of test$test2[i] is
1/test1[i]
or else If test$test1[i] is not 0, then the value of test$test2[i] is
39
how should i programme in R to make it happen?
thanks a lot!