How to Apply the c() Function in R (Example Code)
This tutorial explains how to combine values into a vector or list using the c() function in the R programming language.
Creation of Example Data
input_1 <- letters[3:1] # Create first input input_1 # Print first input # [1] "c" "b" "a" |
input_1 <- letters[3:1] # Create first input input_1 # Print first input # [1] "c" "b" "a"
input_2 <- LETTERS[8:5] # Create second input input_2 # Print second input # [1] "H" "G" "F" "E" |
input_2 <- LETTERS[8:5] # Create second input input_2 # Print second input # [1] "H" "G" "F" "E"
Example: Concatenating Two Data Objects Using c() Function in R
final_vector <- c(input_1, input_2) # Apply c() function final_vector # Return final output to RStudio console # [1] "c" "b" "a" "H" "G" "F" "E" |
final_vector <- c(input_1, input_2) # Apply c() function final_vector # Return final output to RStudio console # [1] "c" "b" "a" "H" "G" "F" "E"