This is an R Markdown document will serve to show examples of various data types and structures.

##Generating current date/time data

lubridate::today()
## [1] "2024-09-23"
lubridate::now()
## [1] "2024-09-23 17:46:10 EDT"

##Generating character, numeric and boolean data vectors.

char_vector <- c("Tirck", "or", "Treat")
num_vector <- c(1,2,3)
bool_vector <- c(TRUE, FALSE, TRUE)
char_vector
## [1] "Tirck" "or"    "Treat"
num_vector
## [1] 1 2 3
bool_vector
## [1]  TRUE FALSE  TRUE

##Generating a sample 3-dimensional array.

array1 <- array(1:12, dim = c(2, 3, 2))
array1
## , , 1
## 
##      [,1] [,2] [,3]
## [1,]    1    3    5
## [2,]    2    4    6
## 
## , , 2
## 
##      [,1] [,2] [,3]
## [1,]    7    9   11
## [2,]    8   10   12

##Generating sample data frame.

data <- data.frame(
  month= c("Jan", "Feb", "March"),
  days= c(31,28,31)
)
head(data)
##   month days
## 1   Jan   31
## 2   Feb   28
## 3 March   31

##Generating sample list.

my_list <- list(
  name = "John",
  age = 29,
  scores = c(93, 100, 98),
  is_student = TRUE
)
my_list
## $name
## [1] "John"
## 
## $age
## [1] 29
## 
## $scores
## [1]  93 100  98
## 
## $is_student
## [1] TRUE

##Generating tibble from vectors.

library(tibble)
my_tibble <- tibble(
  x = 1:10,
  y = 5,
  z = x + y
)
my_tibble
## # A tibble: 10 × 3
##        x     y     z
##    <int> <dbl> <dbl>
##  1     1     5     6
##  2     2     5     7
##  3     3     5     8
##  4     4     5     9
##  5     5     5    10
##  6     6     5    11
##  7     7     5    12
##  8     8     5    13
##  9     9     5    14
## 10    10     5    15