Hi Kristina,
Thierry's solution is certainly the "correct" one in terms of keeping
within R's philosophy... but I personally find a series of conditional
assignments easier to understand - see below for an example.
HTH,
Stephan
#
# Example
Dear Thierry,
thank you so much!
Quoting "ONKELINX, Thierry" :
Dear Kristina,
Use ifelse(). Note that you must use '==' to test for equality. '=' is
an assignment.
Freqg$condition <- with(freqg, ifelse(mat==1 & flank==1, 1, ifelse(mat
== 2 & flank == 1, 2, NA)))
HTH,
Thierry
-
Dear Kristina,
Use ifelse(). Note that you must use '==' to test for equality. '=' is
an assignment.
Freqg$condition <- with(freqg, ifelse(mat==1 & flank==1, 1, ifelse(mat
== 2 & flank == 1, 2, NA)))
HTH,
Thierry
ir.
3 matches
Mail list logo