Combine Arguments into a Vector in R Programming – c() Function

c() function in R Language is used to combine the arguments passed to it.

Syntax: c(…)

Parameters:
…: arguments to be combined

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# R program to cumulative maxima
  
# Calling c() function
x <- c(1, 2, 3, 4)
x

chevron_right


Output:

[1] 1 2 3 4

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# R program to cumulative maxima
  
# Calling c() function
x <- c("a", "b", "c", "d")
x

chevron_right


Output:

[1] "a" "b" "c" "d"
My Personal Notes arrow_drop_up

Recommended Posts:


Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.