# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .r
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: R
#     language: R
#     name: ir
# ---

# # R cheat sheet
# ![](https://www.r-project.org/Rlogo.png)

# **ToC**
#  - [Basics](#Basics)
#    - [Concatenation](#Concatenation)
#    - [Numeric operations](#Numeric-operations)
#    - [List all variables in memory](#List-all-variables-in-memory)
#    - [Getting help](#Getting-help)

# ## Basics
# Concatenation, length of vectors, numeric operations, matrix creation
#
# ### Concatenation

x = c(1,2,3,4,5,6) #concatenate to create a vector
x

length(x)

# ### Numeric operations
# vector 1 + vector 2 is a element by element summation

y = c(8,9,10,11,12,14)
x_y = x+y
x_y

# ### List all variables in memory
# use `ls()`

ls()

# remove variables using `rm(var_name)`

rm('x_y')
ls()

# ### Getting help
# use `?symbol` to get help

?ls

# ### Build a matrix
# use `matrix(data, nrow, ncol)` method to build a nd matrix

m1 = matrix(data= x, nrow=2, ncol=3)
m1



StarcoderdataJupyterScriptsDedupFiltered