Transposing Matrices
Transposition is the operation of swapping the rows and columns of a matrix. In R, this is done with the t() function.
Example
123456# Initial matrix m <- matrix(1:6, nrow = 2) m # Transposed matrix t(m)
The original matrix has 2 rows and 3 columns. After transposition, it becomes 3 rows and 2 columns.
Opgave
Swipe to start coding
You have a vector num. Your goal is to:
- Build a matrix from
numand assign it to themvariable. - Output the transposed
mmatrix.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 29
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Fantastisk!
Completion rate forbedret til 2.27
Transposing Matrices
Stryg for at vise menuen
Transposition is the operation of swapping the rows and columns of a matrix. In R, this is done with the t() function.
Example
123456# Initial matrix m <- matrix(1:6, nrow = 2) m # Transposed matrix t(m)
The original matrix has 2 rows and 3 columns. After transposition, it becomes 3 rows and 2 columns.
Opgave
Swipe to start coding
You have a vector num. Your goal is to:
- Build a matrix from
numand assign it to themvariable. - Output the transposed
mmatrix.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 29
single