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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CAN
R_basis
Commits
9953af68
Commit
9953af68
authored
5 years ago
by
hpolvech
Browse files
Options
Downloads
Patches
Plain Diff
HTML_tuto: terminated
parent
656d8814
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide 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 */
color: #729FCF ;
left: 5%;
}
h2 { /* Header 2 */
color: darkblue ;
left: 10%;
}
h1 { /* Header 1 */
color: #034b6f ;
}
...
...
@@ -207,7 +211,7 @@ Compute the factorial of 9 (`9!`)
```
\
**or**
or
```{r calculatorstep12, include=TRUE}
factorial(9)
```
...
...
@@ -390,9 +394,8 @@ 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
...
...
@@ -518,116 +521,158 @@ ls()
\
# Packages
## Installing packages
<fieldset id='pencadre' style='text-align: left'>
<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
install.packages("tidyverse")
```
</fieldset>
```R
install.packages("ggplot2")
\
\
# Complex variable type
### Vector (aka list)
```{r Vecstep1, include=TRUE}
c(1, 2, 3, 4, 5)
```
## Loading packages
or
```{r
packages
step
1
, include=TRUE}
sessionInfo(
)
```{r
Vec
step
2
, include=TRUE}
c(1:5
)
```
\
\
A mathematical calculation can be performed on the elements of the vector:
```{r
packages
step
2
, include=TRUE}
library(tidyverse
)
```{r
Vec
step
3
, include=TRUE}
2^(1:5
)
```
```R
sessionInfo()
```{r Vecstep4, include=TRUE}
x <- 1:5
2^x
```
\
\
To determine the type of the elements of a vector:
```{r
packages
step
4
, include=TRUE}
unloadNamespace("tidyverse"
)
```{r
Vec
step
5
, include=TRUE}
typeof(x
)
```
```R
sessionInfo()
```{r Vecstep6, include=TRUE}
typeof(x + 0.5)
x + 0.5
```
\
# Complex variable type
## Vector (aka list)
```
R
c(1, 2, 3, 4, 5
)
```
{r Vecstep7, include=TRUE}
is.vector(x
)
```
\pause
\
\
```R
1:5
```{r Vecstep8, include=TRUE}
y <- c(a = 1, b = 2, c = 3, d = 4, e = 5)
typeof(y)
is.vector(y)
```
\pause
\
\
We can compare the elements of two vectors:
```R
2^(1:5)
```{r Vecstep9, include=TRUE}
x
y
x == y
```
\pause
\
\
If you use `all.equal` :
```R
x <- 1:5
2^x
```{r Vecstep10, include=TRUE}
all.equal(x, y)
isTRUE(all.equal(x, y))
isTRUE(all.equal(x, y, check.attributes = FALSE))
```
\
\pause
<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>
```R
log(x)
logarithm(x)
base_test(x, base = 10)
```
\
\
## Vector (aka list)
# Packages
### Installing packages
```R
typeof(x
)
install.packages("tidyverse"
)
```
\pause
or click on `Tools` and `Install Packages...`

\
```R
typeof(x + 0.5
)
install.packages("ggplot2"
)
```
\pause
### Loading packages
```
R
is.vector(x
)
```
{r packagesstep1, include=TRUE}
sessionInfo(
)
```
\pause
\
```R
y <- c(a = 1, b = 2, c = 3, d = 4, e = 5)
typeof(y)
is.vector(y)
```{r packagesstep2, include=TRUE}
library(tidyverse)
```
\pause
```R
x == y
sessionInfo()
```
### Unloading packages
```{r packagesstep4, include=TRUE}
unloadNamespace("tidyverse")
```
\pause
```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