Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R_basis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CAN
R_basis
Commits
9953af68
Commit
9953af68
authored
Mar 23, 2020
by
hpolvech
Browse files
Options
Downloads
Patches
Plain Diff
HTML_tuto: terminated
parent
656d8814
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
session_1/HTML_tuto.Rmd
+106
-61
106 additions, 61 deletions
session_1/HTML_tuto.Rmd
with
106 additions
and
61 deletions
session_1/HTML_tuto.Rmd
+
106
−
61
View file @
9953af68
...
@@ -12,6 +12,10 @@ h3 { /* Header 3 */
...
@@ -12,6 +12,10 @@ h3 { /* Header 3 */
color: #729FCF ;
color: #729FCF ;
left: 5%;
left: 5%;
}
}
h2 { /* Header 2 */
color: darkblue ;
left: 10%;
}
h1 { /* Header 1 */
h1 { /* Header 1 */
color: #034b6f ;
color: #034b6f ;
}
}
...
@@ -207,7 +211,7 @@ Compute the factorial of 9 (`9!`)
...
@@ -207,7 +211,7 @@ Compute the factorial of 9 (`9!`)
```
```
\
\
**or**
or
```{r calculatorstep12, include=TRUE}
```{r calculatorstep12, include=TRUE}
factorial(9)
factorial(9)
```
```
...
@@ -390,8 +394,7 @@ This block allows you to view the different outputs (?help, graphs, etc.).
...
@@ -390,8 +394,7 @@ This block allows you to view the different outputs (?help, graphs, etc.).


\
### Functions are also variables
Test that your `logarithm` function can work in base 10
Test that your `logarithm` function can work in base 10
...
@@ -518,116 +521,158 @@ ls()
...
@@ -518,116 +521,158 @@ ls()
\
\
# Packages
<fieldset id='pencadre' style='text-align: left'>
## Installing packages
<legend style='border: 0px;'>Summary box</legend>
<li> Assigning a variable is done with ` <- `.</li>
<li> The assigned variables are listed in the environment box.</li>
<li> Variable names can contain letters, numbers, underscores and periods. </li>
<li> Functions are also variable and can write in several forms</li>
<li> An editing box is available on Rstudio.</li>
```R
</fieldset>
install.packages("tidyverse")
```
```R
\
install.packages("ggplot2")
```
## Loading packages
\
```{r packagesstep1, include=TRUE}
# Complex variable type
sessionInfo()
```
\
### Vector (aka list)
```{r
packages
step
2
, include=TRUE}
```{r
Vec
step
1
, include=TRUE}
library(tidyverse
)
c(1, 2, 3, 4, 5
)
```
```
or
```
R
```
{r Vecstep2, include=TRUE}
sessionInfo(
)
c(1:5
)
```
```
\
\
```{r packagesstep4, include=TRUE}
\
unloadNamespace("tidyverse")
A mathematical calculation can be performed on the elements of the vector:
```{r Vecstep3, include=TRUE}
2^(1:5)
```
```
```R
```{r Vecstep4, include=TRUE}
sessionInfo()
x <- 1:5
2^x
```
```
\
\
# Complex variable type
\
To determine the type of the elements of a vector:
## Vector (aka list)
```{r Vecstep5, include=TRUE}
typeof(x)
```
```R
c(1, 2, 3, 4, 5)
```{r Vecstep6, include=TRUE}
typeof(x + 0.5)
x + 0.5
```
```
\pause
```
R
```
{r Vecstep7, include=TRUE}
1:5
is.vector(x)
```
```
\pause
\
```R
\
2^(1:5)
```{r Vecstep8, include=TRUE}
y <- c(a = 1, b = 2, c = 3, d = 4, e = 5)
typeof(y)
is.vector(y)
```
```
\pause
\
```R
\
x <- 1:5
We can compare the elements of two vectors:
2^x
```{r Vecstep9, include=TRUE}
x
y
x == y
```
```
\pause
\
```R
\
log(x)
logarithm(x)
If you use `all.equal` :
base_test(x, base = 10)
```{r Vecstep10, include=TRUE}
all.equal(x, y)
isTRUE(all.equal(x, y))
isTRUE(all.equal(x, y, check.attributes = FALSE))
```
```
\
<fieldset id='pencadre' style='text-align: left'>
<legend style='border: 0px;'>Summary box</legend>
<li> A variable can be of different types : `numeric`, `character`, `vector`, etc.</li>
<li> Calculations and comparisons apply to vectors.</li>
<li> Do not hesitate to use the help box to understand functions! </li>
</fieldset>
\
## Vector (aka list)
\
# Packages
### Installing packages
```R
```R
typeof(x
)
install.packages("tidyverse"
)
```
```
\pause
or click on `Tools` and `Install Packages...`

\
```R
```R
typeof(x + 0.5
)
install.packages("ggplot2"
)
```
```
\pause
### Loading packages
```
R
```
{r packagesstep1, include=TRUE}
is.vector(x
)
sessionInfo(
)
```
```
\pause
\
```R
```{r packagesstep2, include=TRUE}
y <- c(a = 1, b = 2, c = 3, d = 4, e = 5)
library(tidyverse)
typeof(y)
is.vector(y)
```
```
\pause
```R
```R
x == y
sessionInfo()
```
### Unloading packages
```{r packagesstep4, include=TRUE}
unloadNamespace("tidyverse")
```
```
\pause
```R
```R
all.equal(x, y
)
sessionInfo(
)
```
```
\
##See you to Session#2 : "Introduction to Tidyverse"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment