Len of list in r
Ngày đăng:
21/02/2022
Trả lời:
0
Lượt xem:
89
R List LengthTo get length of list in R programming, call length() function and pass the list as argument to length function. The syntax to call length function with list myList as argument is length(myList)The length function returns an integer representing the number of items in the list. ExamplesIn the following program, we will create a list containing some string values and find its length programmatically using length() function. example.R myList <- list("Sunday", "Monday", "Tuesday", "Wednesday") listLength = length(myList) cat("List length is :", listLength)Output Now, let us create an empty list and verify if the lists length is zero or not. example.R myList <- list() listLength = length(myList) cat("List length is :", listLength)Output List length is : 0ConclusionIn this R Tutorial, we learned how to find the length of a list in R programming using length() function, with the help of examples. |