~/ learn/ afm-112/ cards/ df[rows, cols], subset(), and the trailing comma
1 of 11

In R, type the expression that keeps every row of orders but only the order_id and amount columns.

In R, type the expression that keeps every row of orders but only the order_id and amount columns.

Answer

orders[, c("order_id", "amount")]

Blank before the comma is all rows; the name vector after it picks the columns. A 12 × 2 data frame.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/665cc48a-7f34-4d21-838f-70b76816f9ab/flashcard utf-8 LF