0是假 NULL、NA無法辨認真假 除了以上3個其他的都是真 > if (NULL) print("OK") else print("Error") Error in if (NULL) print("OK") else print("Error") : argument is of length zero > if (NA) print("OK") else print("Error") Error in if (NA) print("OK") else print("Error") : missing value where TRUE/FALSE needed > if (0) print("OK") else print("Error") [1] "Error" > if (1) print("OK") else print("Error") [1] "OK" > if (-1) print("OK") else print("Error") [1] "OK"