DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Create A Vector, Append Values.

  • submit to reddit
        To create a mathematical vector, you can just initialize a column of numbers with c(). As long as all of your input is of the same type, you don't hit any snags. Note the is.vector() function will say this is a vector:

> v <- c(1, 2, 3) 
> is.vector(v)