chapter  2
19 Pages

Logic and R

ByWilliam B. Claster

The logic of modern computer science has roots in Aristotle’s efforts. Aristotle’s central observation with regard to the study of logic was that arguments were valid or not based on their logical structure, independent of the non-logical words involved. In many programming languages, common datatypes are integers, decimal numbers, arrays, and lists. There is not a function in R called datatype which we could use to test the data type of an object, although there are various functions that serve a similar purpose. In many programming languages defining something as an integer as opposed to a decimal will have unexpected consequences. Logical operators occur in R programming when we do subsetting and we want to select rows that satisfy the conjunction of two conditions. When running comparisons using the arithmetic operators within the context of working with a dataframe, it is likely that some of the entries in the dataframe will be missing.