#a variable is a container that store any given value
x=10
x+20
## [1] 30
#scalar-it is a single value
#vector-it is a the sequence or elements of the same type
a=c(1,2,3,4)
#matrix
m=matrix(1:6,nrow=2,ncol=3)
print(m)
## [,1] [,2] [,3]
## [1,] 1 3 5
## [2,] 2 4 6
#dataframe-similar to a table or spreadsheet,where each column can contain different types of data(integere,character)
df=data.frame(Name=c("mansi","mahi","astha"),Age=c(22,22,21))
print(df)
## Name Age
## 1 mansi 22
## 2 mahi 22
## 3 astha 21
#a dataframe can have multiple data types unlike a matrix
#List- it can hold elements of various types, such as numbers,strings,vectors and even list
my_list=list(name="astha",age=21,scores=c(80,90))
print(my_list)
## $name
## [1] "astha"
##
## $age
## [1] 21
##
## $scores
## [1] 80 90
#the dollar sign is use to access aspecific column from a list or dataframe in R