vector = c(1,2,'3')
typeof(vector)
list_1 = list(1,2,'3')
class(list_1)
length(list_1)
list_2 = list('Manish',25,'Male')
list_3 = list(
vector = c(1,2,3,'4'),
Array = array((1:4),c(2,2)),
logic = c(TRUE, FALSE)
)
#names(list_3)
# one way to fetch the data
list_3$vector[1]
list_3[[1]][1]
#calling array
class(list_3$Array[1,])
class(list_3[[2]][2,])
#if we are accessing a single object from list then we can have
#double squre bracket so that it will define the type of object was stored
#but if accessing multiple object form list then better we can go with
#single squre bracket because that should be list only
# even if you will access single object from list in single squre bracket
# that will also be a list only
class(list_3[c(1,2)])
class(list_3[1])
length(list_3)
# adding a new element in list_3
list_3[[length(list_3)+1]] = c(23.4,67.2)
list_3
list_3[[5]] = 4
length(list_3)
list_3[[6]] = c(34,45,25,73)
length(list_3)
list_3
#removing elements from list
list_3[[4]] = NULL
length(list_3)
list_3 = list_3[-5]
list_3
names(list_3)
list_3$logic = NULL
list_3
# combining lists
clist_1 = list(c(1,2,3,4), "Manish")
clist_2 = list("Ashish", 34,matrix(c(4,6,8,3), nrow =2, ncol = 2))
# function c() is used to concatinate the lists
concat_list = c(clist_1,clist_2)
names(concat_list) = c('vector','string_1','string_2','number','matrix')
length(concat_list)
names(concat_list)
To embed this project on your website, copy the following code and paste it into your website's HTML: