w3

Run Settings
LanguageC
Language Version
Run Command
WEEK 3: A) Implement R Script to create a list. list1 <- list(1, "pradeep", c(1,2,3), 6:10) list1 Output: [[1]] [1] 1 [[2]] [1] "pradeep" [[3]] [1] 1 2 3 [[4]] [1] 6 7 8 9 10 second method: list1 <- list(1, "pradeep", c(1,2,3), 6:10) str(list1) Output: List of 4 $ : num 1 $ : chr "pradeep" $ : num [1:3] 1 2 3 $ : int [6:10] 6 7 8 9 10 B) Implement R Script to access elements in the list. x <- list(TRUE, 14, "pradeep") print(x[1]) print(x[2]) print(x[3]) Output: [[1]] [1] TRUE [[1]] [1] 14 [[1]] [1] "pradeep" C) Implement R Script to merge two or more lists. Implement R Script to perform matrix operation. matrix( c(1,2,3,4,5,6,7,8), nrow = 4, ncol = 2, byrow = FALSE ) Output: [,1] [,2] [1,] 1 5 [2,] 2 6 [3,] 3 7 [4,] 4 8
Editor Settings
Theme
Key bindings
Full width
Lines