I noticed that using T
and F
instead of TRUE
and FALSE
in functions in R gives me the same results. Of course, T
and F
are more concise, yet, I see TRUE
and FALSE
being used more often.
I was wondering whether there is any difference between the two? Is there anything wrong with using T
and F
?
In your examples, "Is there something wrong" probably implies you feel something might be wrong and want to confirm with others while "Is there anything wrong" is just a general inquiry whether anything is wrong at all.
"In" denotes that the item in question is in some way contained. "What's wrong with something" may be used for a group, but may also be used for an individual item—"What's wrong with Paul?"
Did I say something mean? It can also mean: did I make a mistake? (For example: did I make any grammar mistakes?)
The correct phrase is Did I do something wrong? This past form is made up of Did + <pronoun> + <base form of the verb>. Example: Did you put the cat out last night? (old form of English: Put you the cat ...?) In your example it is the past tense of do.
T
and F
can be re-defined, but TRUE
and FALSE
are reserved words and cannot be re-defined.
> TRUE <- 1L Error in TRUE <- 1L : invalid (do_set) left-hand side to assignment > FALSE <- 0L Error in FALSE <- 0L : invalid (do_set) left-hand side to assignment > T <- F # yikes, this would be hard to debug!
Personally, I sometimes use T
and F
when I use R interactively, but I never use them in production code or packages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With