When working with R, often you will be seeking for help. Trust me, even the masteRs seek help. To do so, in RStudio
you can go to the task bar on the top and look for Help>R Help. The same can be done using some commands.
#for example we want to know more about the `plot` command
help(plot)
# another way of doing it
?plot
The RStudio website can provide you cheat sheets to a lot of useful functions in R and variety of R packages. They contain a summary of all the functions and few examples on how you can use them. I will very much encourage you to have a look at the following cheat sheets provided on the Rstudio website:
Operators perform operations i.e. they carry out specific tasks. We use standard symbols instead of writing long sentences to perform assignment, mathematical, logical, and relational operations.
We have covered this in objects but to re-iterate, these operators are used to create/define objects.
Operator | Description |
---|---|
<- ‘or’ = ‘or’ <<- | Leftwards assignment |
-> ‘or’ ‘->>’ | RIghtwards assignment |
Operator | Description |
---|---|
+ | Addition |
- | Substraction |
* | Multiplication |
/ | Division |
^ | Exponent |
%% | Modulus i.e. Remainder from division |
%/% | Integer division i.e. quotient is rounded to integer |
Operator | Description |
---|---|
! | NOT |
&& | AND |
|| | OR |
& | Element-wise AND |
| | Element-wise OR |
Operator | Description |
---|---|
> | Greater than |
< | Less than |
== | Equal to |
>= | Greater than or equal to |
<= | Less than or equal to |
!= | Not equal to |
Introduction to R by Dr. Sarath Chandra Dantu
This course material is available under a Creative Commons BY-SA license (CC BY-SA) version 4.0
Comments
One thing to note, anything written after # will be interpreted by R as a comment. You will notice that I use them very frequently to explain the example code.