Python and R #1.2: Indexing and slicing

Опубликовано: 06 Март 2026
на канале: Programming and Linear Algebra for Biologists
48
2

How can I find the first five collected plants with stem heights above 2 meters? And what were the latitudes and longitudes of those plants? In this video we'll learn how to index a dataset to answer these sorts of questions. In both Python and R we cover numeric indexing. In Python we also get an introduction to list comprehensions, whereas in R we do Boolean indexing instead. I'll also show you how to reuse previous scripts without copying and pasting code.

GitHub site with data and code: https://github.com/lvclark/R_Python_v...

Previous video (data import):    • Python and R #1.1: Data import  

Table of Contents:

00:00 - Programming with Python and R: Indexing and Slicing
00:09 - Last time
01:15 - Learning objectives of this video
02:43 - Reminder about these videos
03:36 - Python
05:21 - Importing variables from another script
10:18 - Slicing
14:12 - Exercise
21:50 - Subsetting with list comprehensions
24:19 - Omiitting items with list comprehensions
27:31 - Subsetting by value
29:41 - Subsetting one list by value in another
33:08 - Exercise
38:28 - Indexing in R
42:59 - Getting a series of values
45:41 - Subsetting by specific indices
46:42 - Omitting indices
47:45 - Boolean indexing
50:59 - Exercise
54:18 - NSF Acknowledgement