Object-Oriented Programming with S3 and R6 in R
Richie Cotton
Data Evangelist at DataCamp
(x <- rexp(10))
0.195051 2.191040 0.498703 0.976122 0.299001
0.105187 0.090073 2.328233 3.043201 2.129631
class(x) <- "random_numbers"
x
0.195051 2.191040 0.498703 0.976122 0.299001
0.105187 0.090073 2.328233 3.043201 2.129631
attr(,"class")
"random_numbers"
class(x)
"random_numbers"
typeof(x)
"double"
is.numeric(x)
TRUE
length(x)
10
mean(x)
1.1856
class()
Object-Oriented Programming with S3 and R6 in R