What is a Vector?
If you are familiar with any other programming language, you may superficially guess what vector is. In simple wording, it's like an array in which you can store multiple values. But why should we start learning data types with arrays straightaway?
The answer is simple - even simple numbers (real, integer, complex), a text string is also considered as a vector, having the length of 1. So let's stop with the single-element vectors. What types are available in R? These are:
logical
- storing logical valuesTRUE
/T
andFALSE
/F
.numeric
/double
- consists of real numbers.integer
- consists of integer numbers.complex
- consists of complex numbers.character
- consists of characters (text).
To check the type of a specific variable, you need to use the typeof()
function, passing the necessary variable as a parameter. For example,
12test = TRUE typeof(test)
The output of the script above is:
[1] "logical"
Practice using this function by yourself!
Swipe to start coding
- Assign value
10
to variablechapter
. - Output the type of the variable
chapter
.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Сумаризуйте цей розділ
Пояснити код у file
Пояснити, чому file не вирішує завдання
Awesome!
Completion rate improved to 12.5
What is a Vector?
Свайпніть щоб показати меню
If you are familiar with any other programming language, you may superficially guess what vector is. In simple wording, it's like an array in which you can store multiple values. But why should we start learning data types with arrays straightaway?
The answer is simple - even simple numbers (real, integer, complex), a text string is also considered as a vector, having the length of 1. So let's stop with the single-element vectors. What types are available in R? These are:
logical
- storing logical valuesTRUE
/T
andFALSE
/F
.numeric
/double
- consists of real numbers.integer
- consists of integer numbers.complex
- consists of complex numbers.character
- consists of characters (text).
To check the type of a specific variable, you need to use the typeof()
function, passing the necessary variable as a parameter. For example,
12test = TRUE typeof(test)
The output of the script above is:
[1] "logical"
Practice using this function by yourself!
Swipe to start coding
- Assign value
10
to variablechapter
. - Output the type of the variable
chapter
.
Рішення
Дякуємо за ваш відгук!
Awesome!
Completion rate improved to 12.5single