Lovesh Gamma R Assignment
Lovesh Gamma R Assignment
# Example of is.numeric()
# Example of is.integer()
# Example of is.character()
# Example of is.logical()
# Example of is.factor()
library(lubridate)
# Example of is.list()
# Example of is.data.frame()
# Example of is.vector()
# Example of is.matrix()
nrow = 2,
ncol = 3
# Example of is.array()
1:24,
dim = c(4, 3, 2)
number_of_departments <- 5
print(average_employees_per_department) # Output: 30
levels(employee_gender)
complex_number <- 3 + 4i
print(class(complex_number)) #Complex
print(raw_data) # Output: 44 61 74 61
print(class(raw_data)) #Raw
employee <- list("Name = "John Doe", Age = 35, Salary = 60000, Department =
"Finance"")
print(employee)
print(class(employee)) # List
print(employee_data)
print(class(employee_data)) # DataFrame
print(sales)
print(departments)
print(is_profitable)
print(class(departments))
print(class(is_profitable)) # Vector
nrow = 2,
ncol = 3,
byrow = TRUE
print(sales_matrix)
print(class(sales_matrix))
# Example using || and |
x <- TRUE
y <- FALSE
result_single <- x || y
# Example using !
x <- TRUE
not_x <- !x
x <- TRUE
y <- FALSE
x <- c(1, 2, 3)
y <- c(1, 2, 3)
z <- c(1, 2, 4)
x <- TRUE
print(result) # Output: 2 3
output