3+1
## [1] 4
2-5
## [1] -3
4^5
## [1] 1024
8^4
## [1] 4096
100^(1/2)
## [1] 10
sqrt(100)
## [1] 10
exp(1)
## [1] 2.718282
log(100)
## [1] 4.60517
sin(pi/2)
## [1] 1
cos(0)
## [1] 1
bienvenidos <- ("Asignacion 1 en R")
typeof(bienvenidos)
## [1] "character"
x <- 1.7
class(x)
## [1] "numeric"
is.numeric(x)
## [1] TRUE
is.numeric(bienvenidos)
## [1] FALSE
y = as.numeric(x)
x =1.34
class(x)
## [1] "numeric"
y = as.integer(x)
is.integer(y)
## [1] TRUE
class(y)
## [1] "integer"
c <- 3.5+4i
is.complex(c)
## [1] TRUE
is.complex(y)
## [1] FALSE
class(c)
## [1] "complex"
logical = T
logical
## [1] TRUE
l = FALSE
class(l)
## [1] "logical"
str <- "Programar en R"
class(str)
## [1] "character"
is.character(str)
## [1] TRUE
numeros <- c(1, 2, 3, 4, 5)
numeros
## [1] 1 2 3 4 5
class(numeros)
## [1] "numeric"
length(numeros)
## [1] 5
numeros[3]
## [1] 3
numeros[5]
## [1] 5