Subsetting Vectors

Jim Duggan · 2024

R provides a range of flexible approaches that can be used to subset data contained in atomic vectors and lists. This chapter presents important subsetting operations, and knowledge of these is key in terms of understanding later chapters on list and data frame processing. Starting with atomic vectors, the four main ways to subset an atomic vector are listed: by positive integer, using the minus sign, with a logical vector, and using the element name. It then summarises the three different operators uses for accessing lists. R&s;s looping structure is introduced, and then used to process list elements contained in the CRAN package repurrrsive.

Read the paper · More papers on PaperTik