# combine ## Definition(s) ### Context: [[Nexus - Google Analytics Certificate Course#7.2 Google Analytics - 7 Data Analysis with R Programming - Module 2 - Programming using RStudio Programming using RStudio|Google Analytics Certificate - R programming]] #### Sub-context [[R Functions]] >[! Definition] > This function just combines the arguments together as a one dimensional sequence of the same datatype. All arguments coerced to same type. ## Examples ```r c(12, 11.2, 2, 3, 4.25) # doubles vector ``` In the above example, the list contains both integers and doubles. The `c()` function will coerce all values to be doubles; ie the resulting array will look like. ```r [1] 12.0 11.2 2.0 3.0 4.25 ``` Examples of vectors in other data types ```r c(1L, 5L, 15L) # creates a vector of integer type. the L character must follow each number otherwise default to doubles / float c("Sara" , "Lisa" , "Anna") # vector of strings c(TRUE, FALSE, TRUE) # logical values vector c(4:10) # generates a sequence of integers ``` ## Related [[CONCAT]] ## Resources [R Documentation: Combine](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/c) [Statology c() explainer](https://www.statology.org/c-function-in-r/) ## Flashcards The below code are generated for use with [Spaced Repetition plugin](https://github.com/st3v3nmw/obsidian-spaced-repetition/) [docs](https://www.stephenmwangi.com/obsidian-spaced-repetition/) This function just combines the arguments together as a one dimensional sequence of the same datatype. All arguments coerced to same type. @@@ [[combine|c()]]