I've been struggling for a while with a quite simple function. I am trying to analyse reaction times and I want to take the logarithm of them. I want to convert all negative values to the number 1 before computing the logarithm.

I guess the problem is something about the brackets- but I have been trying around and now I am just confused. I hope that anyone of you with a bit more experience looks at it and sees the problem right away

You don't mention WHAT problem you have with this function.

Your screen print shows that RStudio is not happy with the syntax:
see the two red crosses in lines 280 and 281.
Maybe you need a space immediately after if ?

You say you intend to change times but you don't do this.
I think you meant times = ifelse( .... ?