head & tail Functions in R (6 Examples) | Data Frame, Vector & List Object | Extract First/Last Rows

preview_player
Показать описание
R code of this video:

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:

Рекомендации по теме
visit shbcf.ru