'New error? No first element being used when condition has length > 1? [duplicate]

Problem

Notice that when I run the code on Computer 2 (R version 4.2.0)

if(c(1,2,3,4) == 1){ print("Hi") }

it is going straight to error. Is there any way to make it automatically use the first element like in Computer 1 (R version 4.1.2)?

On Computer 1 with R version 4.1.2 enter image description here

On Computer 2 with R version 4.2.0 enter image description here

r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source