I want to create a function that according to a condition modifies the value of a variable, or leaves it as it is. So I have these two objects which are integers:
q <- L()
q_a <- L()
And the function:
convert.q <- function(q){
if (q >= 3){
q_a == 3
} else {
q_a == q_a
}
}
convert.q(q)
This function is returning me a FALSE statement when executing it. Any idea how to solve it?
Just an example of what I want:
q <- 10
q_a <- 10
convert.q(q)
Result:
q_a == 3
I tried changing variables to numeric, but the result was the same.
Aucun commentaire:
Enregistrer un commentaire