Task 1: Learning RStudio environment

(No script needed for this task)

Task 2: Setting the working directory

(No script needed for this task)

Task 3: Creating vectors

Creating four vectors with appropriate data types

studentID <- c(101, 102, 103, 104, 105) firstName <- c(“Alice”, “Bob”, “Charlie”, “Diana”, “Ethan”) lastName <- c(“Smith”, “Brown”, “Taylor”, “Johnson”, “Lee”) passFail <- c(TRUE, FALSE, TRUE, TRUE, FALSE)

Printing vectors and checking their type and structure

print(studentID) str(studentID)

print(firstName) str(firstName)

print(lastName) str(lastName)

print(passFail) str(passFail)

Task 4: Creating a data frame

Creating a data frame from the vectors

studentTable <- data.frame(studentID, firstName, lastName, passFail)

Printing the data frame and checking its structure

print(studentTable) str(studentTable)

Task 5: Creating matrices

Creating two matrices with different data types

matrix1 <- matrix(1:20, nrow = 4, ncol = 5) matrix2 <- matrix(letters[1:20], nrow = 4, ncol = 5)

Printing matrices and checking their type and structure

print(matrix1) str(matrix1)

print(matrix2) str(matrix2)

Task 6: Creating arrays

Creating two arrays with different data types

array1 <- array(1:27, dim = c(3, 3, 3)) array2 <- array(letters[1:27], dim = c(3, 3, 3))

Printing arrays and checking their type and structure

print(array1) str(array1)

print(array2) str(array2)

Task 7: Creating a list

Creating a list with 4 vectors of different types and lengths

vector1 <- c(10, 20, 30) vector2 <- c(“X”, “Y”, “Z”, “W”) vector3 <- c(TRUE, FALSE) vector4 <- c(5.5, 6.7, 8.9)

myList <- list(vector1, vector2, vector3, vector4)

Printing the list and checking its structure

print(myList) str(myList)

Task 8: Creating a nested list

Creating another list that contains the list created in Task 7

nestedList <- list(myList)

Printing the nested list

print(nestedList)