Lists in R:

A list is a R-object which can contain many different types of elements inside it like vectors, functions and even another list inside it.

creating a List

list1 <- list(c(2,5,3),21.3,sin)   # Create a list.
print(list1)     # Print the list.
## [[1]]
## [1] 2 5 3
## 
## [[2]]
## [1] 21.3
## 
## [[3]]
## function (x)  .Primitive("sin")

Data Frames:

Data frames are tabular data objects. Unlike a matrix in data frame each column can contain different modes of data. The first column can be numeric while the second column can be character and third column can be logical. It is a list of vectors of equal length. Data Frames are created using the data.frame() function. It displays data along with header information. To retrieve data in a particular cell: Enter its row and column coordinates in the single square bracket “[ ]” operator. Example: To retrieve the cell value from the first row, second column of mtcars. >mtcars[1,2] mtcars[row,column] # Create the data frame.

Student data: Data1 : Rno GPA 66 3.80 62 3.78 63 3.88 70 3.72 74 3.69

BMI_data <- data.frame(gender = c("Male", "Male","Female"),     height = c(152, 171.5, 165), weight = c(81,93, 78),Age =c(42,38,26))
print(BMI_data)
##   gender height weight Age
## 1   Male  152.0     81  42
## 2   Male  171.5     93  38
## 3 Female  165.0     78  26
student.rno <- c( 66, 62, 63, 70, 74)
student.gpa <- c( 3.80, 3.78, 3.88, 3.72, 3.69)
student.data1 <- data.frame(student.rno, student.gpa)
student.data1
##   student.rno student.gpa
## 1          66        3.80
## 2          62        3.78
## 3          63        3.88
## 4          70        3.72
## 5          74        3.69
##scattor plot of data elements of student.data1
plot(student.rno, student.gpa)