12 R Udemy Flashcards

1
Q

%%

A

Module (% no Python)

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

#

A

Igual no Python

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

x

A

Equivale a x = 10 no Python

Assign Variable

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

No R artur_faria é má pratica

A

Ideal é artur.faria ou arturFaria

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

class ( )

determina a classe do objeto

A

== type ( ) do Python

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

> nvec cvec lvec

A

num: [1:5] 1 2 3 4 5

chr [1:3] “U” “S” “A”

logic [1:2] TRUE FALSE

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

VECTORS BASICS (can`t combine different types)

> nvec cvec lvec

A

num: [1:5] 1 2 3 4 5

chr [1:3] “U” “S” “A”

logic [1:2] TRUE FALSE

logical vira numeric, numeric vira character

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

> numeros extenso names(numeros) numeros
==>
um dois tres
1 2 3

A

> numeros names(numeros) numeros
==>
um dois tres
1 2 3

sinônimos

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

> v1 v2 v1 * v2
==>s
[1] 5 12 21

A

> x x
==>
[1] 6

mean ( ) - média
prod ( ) - desvio padrão
sd ( ) - desvio padrão

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

> 1 <= 5
==>
[1] TRUE

> 2 == 3
==>
[1] FALSE

> 2 != 3
==>
[1] TRUE

A

X

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

1 <= 5
==>
[1] TRUE

2 == 3
==>
[1] FALSE

2 != 3
==>
[1] TRUE

A

X 1
==>
[1] FALSE TRUE TRUE TRUE

v  u
==>
FALSE FALSE FALSE FALSE FALSE
Warning message:
In v > u : longer object length is not a multiple of shorter object length
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

> v t v > t
[1] TRUE FALSE FALSE TRUE FALSE
Warning message:
In v > t : longer object length is not a multiple of shorter object length

A
1  > 0 T
2 > 9 F
3 > 5 F
4 > 0 T
5 > 9 F
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

nome = “Maria”
print(nome)
==>
[1] “Maria”

("nome",nome)
print("nome",nome)
==>
Warning message in print.default("nome", nome):
"NAs introduzidos por coerção"

print(paste(“nome”,nome))
==>
[1] “nome Maria”

paste(“Meu”,”nome”,”é”,”Maria”)
==>
‘Meu nome é Maria’

A

print(paste0(“Meu”,”nome”,”é”,”Maria”))
==>
[1] “MeunomeéMaria”

cat(“Meu”,”nome”,”é”,nome)
==>
Meu nome é Maria

paste(“Meu”,”nome”,”é”,”Maria”, sep=”&”)
==>
‘Meu&nome&é&Maria’

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

idade = as.integer(readline(prompt=”Digite sua idade: “))
==> (digitei 33)
Digite sua idade: 33

A

nome = readline(prompt=”Digite seu nome: “)
==> (digitei Artur)
Digite seu nome: Artur

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

Lista todos os objetos alocados na memória
ls() # Também pode ser usada a função objects()
==>
‘a’ ‘adic’ ‘altura’ ‘area’ ‘b’ ‘base’ ‘c’ ‘casado’ ‘comprimento’ ‘ctr’ ‘d’ ‘delta’ ‘dist’ ‘divi’ ‘e’ ‘f’ ‘i’ ‘idade’ ‘mult’ ‘nome’ ‘perimetro’ ‘peso’ ‘potencia1’ ‘potencia2’ ‘potencia3’ ‘qtdeFilhos’ ‘quoc’ ‘r’ ‘raio’ ‘resto’ ‘s’ ‘subt’ ‘vetorChar’ ‘vetorComplex’ ‘vetorDouble’ ‘vetorInt’ ‘vetorLog’ ‘vetorRaw’ ‘x’ ‘x1’ ‘x2’ ‘y1’ ‘y2’

# Removendo um objeto específico
remove(altura) # ou rm(altura)
ls()
==>
'a' 'adic' 'area' 'b' 'base' 'c' 'casado' 'comprimento' 'ctr' 'd' 'delta' 'dist' 'divi' 'e' 'f' 'i' 'idade' 'mult' 'nome' 'perimetro' 'peso' 'potencia1' 'potencia2' 'potencia3' 'qtdeFilhos' 'quoc' 'r' 'raio' 'resto' 's' 'subt' 'vetorChar' 'vetorComplex' 'vetorDouble' 'vetorInt' 'vetorLog' 'vetorRaw' 'x' 'x1' 'x2' 'y1' 'y2'
A
# Removendo todos os objetos
remove(list = ls()) # ou rm(list = ls())
ls()
==>
(NADA)
# Removendo objetos específicos
a = 5
b = 6
c = 7
rm(list = c("a", "c"))
ls()
==>
'b'
How well did you know this?
1
Not at all
2
3
4
5
Perfectly