Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Transposing | Matrices
R Introduction: Part II
course content

Contenido del Curso

R Introduction: Part II

R Introduction: Part II

1. Matrices
2. Data Frames
3. Lists

bookTransposing

Good! Matrices are widely used in math, starting with different geometrical transformations, and ending with neural networks (yes, matrices are commonly used in AI).

What if we have a matrix and want to 'rotate' it? (or vice versa)?

In math, this operation is called transposing. It swaps columns with rows. In R this operation is implemented under t() function. This function receives the matrix you want to transpose as the parameter. For example,

123456
# Initial matrix m <- matrix(1:6, nrow = 2) m # Output initial matrix # Output transposed matrix t(m)
copy

As you can see, the initial matrix was 2x3 (2 rows and 3 columns), and the transposed is 3x2.

Tarea

Given the matrix from the previous chapter.

  1. Assign this matrix to the m variable.
  2. Output the transposed m matrix.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 3
toggle bottom row

bookTransposing

Good! Matrices are widely used in math, starting with different geometrical transformations, and ending with neural networks (yes, matrices are commonly used in AI).

What if we have a matrix and want to 'rotate' it? (or vice versa)?

In math, this operation is called transposing. It swaps columns with rows. In R this operation is implemented under t() function. This function receives the matrix you want to transpose as the parameter. For example,

123456
# Initial matrix m <- matrix(1:6, nrow = 2) m # Output initial matrix # Output transposed matrix t(m)
copy

As you can see, the initial matrix was 2x3 (2 rows and 3 columns), and the transposed is 3x2.

Tarea

Given the matrix from the previous chapter.

  1. Assign this matrix to the m variable.
  2. Output the transposed m matrix.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 3
toggle bottom row

bookTransposing

Good! Matrices are widely used in math, starting with different geometrical transformations, and ending with neural networks (yes, matrices are commonly used in AI).

What if we have a matrix and want to 'rotate' it? (or vice versa)?

In math, this operation is called transposing. It swaps columns with rows. In R this operation is implemented under t() function. This function receives the matrix you want to transpose as the parameter. For example,

123456
# Initial matrix m <- matrix(1:6, nrow = 2) m # Output initial matrix # Output transposed matrix t(m)
copy

As you can see, the initial matrix was 2x3 (2 rows and 3 columns), and the transposed is 3x2.

Tarea

Given the matrix from the previous chapter.

  1. Assign this matrix to the m variable.
  2. Output the transposed m matrix.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Good! Matrices are widely used in math, starting with different geometrical transformations, and ending with neural networks (yes, matrices are commonly used in AI).

What if we have a matrix and want to 'rotate' it? (or vice versa)?

In math, this operation is called transposing. It swaps columns with rows. In R this operation is implemented under t() function. This function receives the matrix you want to transpose as the parameter. For example,

123456
# Initial matrix m <- matrix(1:6, nrow = 2) m # Output initial matrix # Output transposed matrix t(m)
copy

As you can see, the initial matrix was 2x3 (2 rows and 3 columns), and the transposed is 3x2.

Tarea

Given the matrix from the previous chapter.

  1. Assign this matrix to the m variable.
  2. Output the transposed m matrix.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 1. Capítulo 3
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
some-alt