Write a function to reverse the rows of a data frame.
MediumProblem Statement
Write a function to reverse the rows of a data frame.
Sample Input
Data Frame: Name Age 1 John 25 2 Alice 30 3 Bob 22
Sample Output
Name Age 3 Bob 22 2 Alice 30 1 John 25
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
# Predefined structure
reverse_rows <- function(df) {
# Your logic here
}
reversed_data <- reverse_rows(data)
print(reversed_data)
Input
Data Frame: Name Age 1 John 25 2 Alice 30 3 Bob 22
Expected Output
Name Age 3 Bob 22 2 Alice 30 1 John 25