dlab-berkeley / R-Fundamentals

D-Lab's 4 part, 8 hour introduction to R Fundamentals. Learn how to create variables and functions, manipulate data frames, make visualizations, use control flow structures, and more, using R in RStudio.
34 stars 9 forks source link

Part 2 - potentially add data frame indexing example #43

Closed alexramiller closed 7 months ago

alexramiller commented 9 months ago

Line 317: notebook currently mentions that you can use numeric indexing with the [row,column] format to subset a dataframe, but doesn't show any examples of what this looks like. Recommend adding in a code chunk that gives a few examples, which could look something like:

# extract the first value of the first column
gap[1,1]

# extract the entire first row
gap[1,]

# extract the entire third column
gap[,3]
heroashman commented 7 months ago

Added - thanks for the example!