Lanmguage R Flashcards
Define ‘Comment’ and how do you code it.
Text written in a program but not run by the computer (#)
Why would anyone want the computer to ignore a part of their file? Three reasons
-Provide context for why something is written the way it is.
-Help other people reading the code understand it faster
-Ignore a line of code and see how a program will run without it
What are the 5 different types of Data?
- Numeric.
- Character
- Logical
- Vectors
- NA
Define numeric data
Any number with or without a decimal point: 23, 0.03 and the numeric null value NA.
Define character data and how is it shown, and how is it also known as.
Any grouping of characters on your keyboard (letters, numbers, spaces, symbols, etc.) or text. Most strings are surrounded by single quotes: ‘ … ‘ or double quotes “ … “, though we prefer single quotes. Sometimes you will hear this type referred to as “string.”
Define logical data.
This data type only has two possible values— either TRUE or FALSE (without quotes). It’s helpful to think of logical types or booleans as on and off switches or as the answers to a “yes” or “no” question.
Define vectors
A list of related data that is all the same type.
Define NA data
This data type represents the absence of a value, and is represented by the keyword NA (without quotes) but it has its own significance in the context of the different types.
The three NA data types
There is a numeric NA, a character NA, and a logical NA.
In order to print a value, you must put the value inside the following syntax:
print()