- Published on

# Common Functions in R Programming

Here are a list of common functions are that used in most R Programs:

`factor()`

: This function is used to convert a vector into a factor. A factor, in case you didn't know, is a variable used to categorize and store data. All data will be stored as integer values in a vector format. Here is a visualization of vectors:

`levels()`

: This function provides access to the levels attribute of a variable. The levels attribute in R represent a vector of all possible values of an original vector. So the levels for the following vector:`[0, 1, 1, 2, 2, 2, 3, 4, 5, 8, 8, 8]`

would be`[0, 1, 2, 3, 4, 5, 8]`

`seq()`

: This function is used to generate sequences from the given inputs. Here are the arguments it takes:`seq(from, to, by, length.out, along.with)`

`from`

: This is the beginning number of the sequence`to`

: This is the terminating number of the sequence`by`

: This is the incrementing factor for the sequence`length.out`

: This number decides the total length of the sequence`along.with`

: This parameter takes an input vector. The resulting output vector from`seq()`

will be the same length as this input vector

### Conclusion

Well that's it for this post! Thanks for following along in this article and if you have any questions or concerns please feel free to post a comment in this post and I will get back to you when I find the time.

If you found this article helpful please share it and make sure to follow me on Twitter and GitHub, connect with me on LinkedIn, subscribe to my YouTube channel.