-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_1_classes_atomicas.R
More file actions
87 lines (74 loc) · 1.08 KB
/
Copy pathscript_1_classes_atomicas.R
File metadata and controls
87 lines (74 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
## Hello world
"Hello world"
print("Hello world")
greeting<-"Hello world"
print(greeting)
## Classes atômicas
#complexo
complexo<-9+3i
is.complex(complexo)
#numerico
numerico_inteiro<-12
is.numeric(numerico_inteiro)
is.integer(numerico_inteiro)
numerico<-12.3
is.numeric(numerico)
is.integer(numerico)
p<-pi
#character
fruta<-"laranja"
print(fruta)
paste(laranja)
fruta
is.character(fruta)
class(fruta)
#logico
TRUE
FALSE
boolean<-TRUE
is.logical(boolean)
class(boolean)
##OPERAÇÕES MATEMÁTICAS
x<-10
y<--12
x+y
x*y
x/y
x^y
x^2
x**2
log(x)
log(x, 2)
exp(x)
sqrt(x)
cos(pi)
sin(pi)
tan(pi)
abs(-3)
abs(y)
##OPERAÇÕES COM STRING
fruta<-"laranja"
substr(fruta,1,2)
substring(fruta, "a","e")
gsub("a", "e", fruta)
frutas<-"laranja abacaxi"
gsub(" ", " ,", frutas)
toupper(fruta)
tolower(fruta)
install.packages("stringr")
library(stringr)
str_to_title(fruta)
#OPERAÇÔES BOOLEANAS
TRUE || TRUE
TRUE || FALSE
FALSE || TRUE
FALSE || FALSE
TRUE && TRUE
TRUE && FALSE
FALSE && TRUE
FALSE && FALSE
!FALSE
!TRUE
!FALSE || FALSE
(!FALSE || FALSE) && FALSE
(!FALSE || !TRUE) == !(FALSE && TRUE)