head & tail Functions in R (6 Examples) | Data Frame, Vector & List Object | Extract First/Last Rows
Автор: Statistics Globe
Загружено: 2023-02-05
Просмотров: 1303
How to return the first or last part of a data object using the head and tail functions in the R programming language. More details: https://statisticsglobe.com/head-tail...
R code of this video:
data <- data.frame(x1 = letters[1:10], # Create example data
x2 = 11:20)
data # Print example data
head(data) # Return head of data frame
head(data, 4) # Return first four rows of data frame
tail(data) # Return tail of data frame
tail(data, 4) # Return last four rows of data frame
vec <- 1:10 # Create example vector
vec # Print example vector
head(vec) # Apply head to vector object
tail(vec) # Apply tail to vector object
my_list <- list(1, # Create example list
5:9,
letters[6:1],
"xxx")
my_list # Print example list
head(my_list, 2) # Apply head to list object
tail(my_list, 2) # Apply tail to list object
Follow me on Social Media:
Facebook – Statistics Globe Page: / statisticsglobecom
Facebook – R Programming Group for Discussions & Questions: / statisticsglobe
Facebook – Python Programming Group for Discussions & Questions: / statisticsglobepython
LinkedIn – Statistics Globe Page: / statisticsglobe
LinkedIn – R Programming Group for Discussions & Questions: / 12555223
LinkedIn – Python Programming Group for Discussions & Questions: / 12673534
Twitter: / joachimschork
Music by bensound.com
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: