VOOZH about

URL: https://www.geeksforgeeks.org/r-language/get-transpose-of-a-matrix-or-data-frame-in-r-programming-t-function/

⇱ Get Transpose of a Matrix or Data Frame in R Programming - t() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Get Transpose of a Matrix or Data Frame in R Programming - t() Function

Last Updated : 15 Jul, 2025
t() function in R Language is used to calculate transpose of a matrix or Data Frame.
Syntax: t(x) Parameters: x: matrix or data frame
Example 1: Output:
 Time demand
1 1 8.3
2 2 10.3
3 3 19.0
4 4 16.0
5 5 15.6
6 7 19.8

 [, 1] [, 2] [, 3] [, 4] [, 5] [, 6]
Time 1.0 2.0 3 4 5.0 7.0
demand 8.3 10.3 19 16 15.6 19.8
Example 2: Output:
 [, 1] [, 2] [, 3]
[1, ] 1 4 7
[2, ] 2 5 8
[3, ] 3 6 9

 [, 1] [, 2] [, 3]
[1, ] 1 2 3
[2, ] 4 5 6
[3, ] 7 8 9
Comment
Article Tags:

Explore