Syntax
R Create a Vector Syntax
In R, create a vector: combines values into a vector — v <- c(1, 2, 3)
Quick Answer
- Syntax
v <- c(1, 2, 3)
RSyntax
Create a Vector
Code example
v <- c(1, 2, 3)
Combines values into a vector.
How to create a vector in R
- Open your R file or editor.
- Copy the example, then replace its sample names and values for your code.
R Create a Vector Syntax
Use v <- c(1, 2, 3).
Related Syntax References
Frequently asked questions
What is the R syntax for create a vector?
Use this pattern: v <- c(1, 2, 3)
Can I copy this R code example?
Yes. Use Copy code and adapt the example to your program.
Is this R syntax different on Mac or Windows?
No. The language syntax is the same across operating systems.
Official source · How we verify