Install R, then R Studio. https://posit.co/download/rstudio-desktop/
Reading up on the help files from official R website.
The R Manuals. https://cran.r-project.org/manuals.html
The help() function and ? help operator
in R provide access to the documentation pages for R functions, data
sets, and other objects, both for packages in the standard R
distribution and for contributed packages. https://www.r-project.org/help.html
Good coding style is like using correct punctuation. You can manage without it, but it sure makes things easier to read. As with styles of punctuation, there are many possible variations. The following guide describes the style that I use (in this book and elsewhere). It is based on Google’s R style guide, with a few tweaks. You don’t have to use my style, but you really should use a consistent style.
http://adv-r.had.co.nz/Style.html
Files names should be meaningful/informative.
Variable and function names should be lowercase. Use underscore (
_ ) to separate words.
=, +, -, <-,
etc.). Comment your code. Each line of a comment should begin with the
comment symbol and a single space: #. Comments should
explain the why, not the what.
Use commented lines of - and = to break up
your file into easily readable chunks.
Different forms of data that can be saved and manipulated are defined and categorized using data types in computer languages, including R. Each R data type has unique properties and associated operations.
R Data types are used to specify the kind of data that can be stored in a variable.
For effective memory consumption and precise computation, the right data type must be selected.
Each R data type has its own set of regulations and restrictions.
Basic data types in R can be divided into the following types:
numeric - (10.5, 55, 787)
integer - (1L, 55L, 100L, where the letter “L”
declares this as an integer)
character (a.k.a. string) - (“k”, “R is exciting”,
“FALSE”, “11.5”).
logical (a.k.a. boolean) - (TRUE or FALSE)
complex - (9 + 3i, where “i” is the imaginary
part)
?datasets()
## starting httpd help server ... done
df <- mtcars
?as.integer
df$mpg2 <- as.integer(df$mpg)
df$mpg3 <- as.numeric(df$mpg2)
str(df)
## 'data.frame': 32 obs. of 13 variables:
## $ mpg : num 21 21 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 ...
## $ cyl : num 6 6 4 6 8 6 8 4 4 6 ...
## $ disp: num 160 160 108 258 360 ...
## $ hp : num 110 110 93 110 175 105 245 62 95 123 ...
## $ drat: num 3.9 3.9 3.85 3.08 3.15 2.76 3.21 3.69 3.92 3.92 ...
## $ wt : num 2.62 2.88 2.32 3.21 3.44 ...
## $ qsec: num 16.5 17 18.6 19.4 17 ...
## $ vs : num 0 0 1 1 0 1 0 1 1 1 ...
## $ am : num 1 1 1 0 0 0 0 0 0 0 ...
## $ gear: num 4 4 4 3 3 3 3 4 4 4 ...
## $ carb: num 4 4 1 1 2 1 4 2 2 4 ...
## $ mpg2: int 21 21 22 21 18 18 14 24 22 19 ...
## $ mpg3: num 21 21 22 21 18 18 14 24 22 19 ...
2 > 3
## [1] FALSE

https://swcarpentry.github.io/r-novice-inflammation/13-supp-data-structures.html
Let me begin by introducing basic math operations.
https://www.codecademy.com/resources/docs/r/operators
2+2 # addition
## [1] 4
5 - 4
## [1] 1
2 * 3
## [1] 6
8/3
## [1] 2.666667
# Plot data ---------------------------
hist(mtcars$mpg)