Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
What is a Vector? | Vectors
TEST R COURSE
course content

Conteúdo do Curso

TEST R COURSE

TEST R COURSE

1. Basic Syntax and Operations
2. Vectors

bookWhat 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 values TRUE/T and FALSE/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,

12
test = TRUE typeof(test)
copy

The output of the script above is:

Practice using this function by yourself!

Tarefa

  1. Assign value 10 to variable chapter.
  2. Output the type of the variable chapter.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 1
toggle bottom row

bookWhat 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 values TRUE/T and FALSE/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,

12
test = TRUE typeof(test)
copy

The output of the script above is:

Practice using this function by yourself!

Tarefa

  1. Assign value 10 to variable chapter.
  2. Output the type of the variable chapter.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 1
toggle bottom row

bookWhat 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 values TRUE/T and FALSE/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,

12
test = TRUE typeof(test)
copy

The output of the script above is:

Practice using this function by yourself!

Tarefa

  1. Assign value 10 to variable chapter.
  2. Output the type of the variable chapter.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

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 values TRUE/T and FALSE/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,

12
test = TRUE typeof(test)
copy

The output of the script above is:

Practice using this function by yourself!

Tarefa

  1. Assign value 10 to variable chapter.
  2. Output the type of the variable chapter.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 2. Capítulo 1
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
some-alt