Arithmetic Operators in R
R has the following arithmetic operators:
Addition: +
Subtraction: -
Multiplication: *
Division: /
Exponentiation: ^
Modulo: %%
The last two might need some explanation:
The ^ operator raises the number to its left to the power of the number to its right: for example 3^2 is 9.
The modulo returns the remainder of the division of the number to the left by the number on its right, for example 5 modulo 3 or 5 %% 3 is 2.
Basic data types in R
R works with numerous data types. Some of the most basic types to get started are:
Decimals values like 4.5 are called numerics.
Natural numbers like 4 are called integers. Integers are also numerics.
Boolean values (TRUE or FALSE) are called logical (TRUE can be abbreviated to T and FALSE to F).
Text (or string) values are called characters.
Note how the quotation marks on the right indicate that "some text" is a character.
R has the following arithmetic operators:
Addition: +
Subtraction: -
Multiplication: *
Division: /
Exponentiation: ^
Modulo: %%
The last two might need some explanation:
The ^ operator raises the number to its left to the power of the number to its right: for example 3^2 is 9.
The modulo returns the remainder of the division of the number to the left by the number on its right, for example 5 modulo 3 or 5 %% 3 is 2.
Basic data types in R
R works with numerous data types. Some of the most basic types to get started are:
Decimals values like 4.5 are called numerics.
Natural numbers like 4 are called integers. Integers are also numerics.
Boolean values (TRUE or FALSE) are called logical (TRUE can be abbreviated to T and FALSE to F).
Text (or string) values are called characters.
Note how the quotation marks on the right indicate that "some text" is a character.
No comments:
Post a Comment