Select the short seedlings
Before you start this intermediate track
Numeric vectors and basic averages. Read data-frame columns and logical filters.
Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.
Understand it, then try it.
A data frame keeps related columns together: each row describes one seedling. The $ operator selects a column. Comparing the height column with 10 creates a logical vector, which then selects matching plant names. Logical indexing lets a single expression apply the same selection rule to every row.
seedlings <- data.frame( plant = c("fern", "moss", "ivy"), height = c(11, 4, 9))short <- seedlings$plant[seedlings$height < 10]cat(paste(short, collapse = " / "), "\n")Each mission is a separate base R script. Run it with Rscript; no packages or input files are needed. Quiz answers show the text printed by cat, without a console prompt.
Track the values line by line. Predict the result before running this example in your own editor.