manipuler un vecteur Flashcards

1
Q

générer des suite de nombre

A

seq()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

généré le chiffre 1 à 9 interval de 2

A

ex : seq( 1,9 by = 2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

façons rapide de générer une séquence à partir de 1 à 15

A

> seq_len (15)

[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

répéter des valeur ou vecteur

A

rep ()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

répéter 2, 10 fois

A

> rep(2,10)

[1] 2 2 2 2 2 2 2 2 2 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

tri par ordre croisant

A

sort (c( ) )
> sort( c(4, -1, 6, 8))
[1] -1 4 6 8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

ranger un vecteur par ordre

A

rank ( c(4, -1, 6, 8))

[1] 2 1 3 4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

renverser un vecteur

A

> rev (1:10)

[1] 10 9 8 7 6 5 4 3 2 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

extraction des premiers élément d’un vecteur

A

> head (1:10, 3)
[1] 1 2 3
head (1:10, -3)
[1] 1 2 3 4 5 6 7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

extraction des derniers élément d’un vecteur

A

> tail (1:10, -3)

[1] 4 5 6 7 8 9 10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

extraction des élément diffèrent d’un vecteur

A

> unique( c(4, 9, 4, 9, 4, 6, 8,6, 8))

[1] 4 9 6 8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

appartenance des valeurs à un vecteur

A

> x 3:5%in% x

[1] FALSE TRUE FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

arrondir

A

> x round( x)
[1] 5 9 4 10 4 6 8 6 8
round( x, 2)
[1] 4.90 9.00 4.30 9.60 4.34 6.00 8.00 6.00 8.00

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

somme et produit des elements d’un vecter

A

> sum( 3:5)
[1] 12
prod(3:5)
[1] 60

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

differerence des elements d’un veteur

A

> diff(3:5)

[1] 1 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

maximum et min d’un vecteur

A

range( vec)

17
Q

un vecteur

A

c(1,3,4,9)

c(“e” , “r”, “y”)

18
Q

object

A

y

19
Q

operation sur les matrix

A

ncol, nrow
rowSum, colSum
rowMean, colMean