Hi all,

I have problem on how to replace value. I have this kind of data set:

structure(list(A = c(0, 12.6, 10.1, 8.1, 14.4, 0, 0, 0, 0, 0.5,
12.9, 25.9, 49, 0, 0, 0, 0, 0, 7.8), B = c(0, 0, 9.1, 9.3, 1.5,
1, 1, 1, 1.7, 6, 0, 0, 0, 1.7, 3.8, 0, 0, 0, 1), C = c(1, 1,
9.100000004, 9.299999999, 1.5, 1, 1, 1, 1.7, 5.999999999, 1,
1, 1, 1.7, 3.800000001, 1, 1, 1, 1)), .Names = c("A", "B", "C"
), row.names = c(NA, 19L), class = "data.frame")

The problem is the value under variable 'C'.   It supposed to be like this:

1) When value is '0' under variable 'B', the next value under variable 'C'
also should be '0'.

2) When value is '1' under variable 'B', there is no changes for values
under variable 'C'.

How do I achieved this by fulfill these two conditions? Thank you so much.


Regards,
Dila

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to