The “rbind” Function in R
Package: Base R (no specific package required)
Purpose: Combines vectors, matrices, or data frames by row.
General Class: Data Manipulation
Required Argument(s):
Vectors, matrices, or data frames to be combined by row.
Notable Optional Arguments:
None
Example:
# Example data for using the rbind function
names <- c("Alice", "Bob", "Charlie")
ages <- c(25, 30, 22)
# Combine two vectors into a data frame by row
combined_df <- rbind(Names = names, Ages = ages)
# Display the result
print(combined_df)In this example, the rbind function is used to combine two vectors (names and ages) into a data frame (combined_df) by row. The resulting data frame has two rows, one for names and one for ages. The rbind function is commonly used for combining data in a row-wise fashion, especially when working with data frames or matrices.