We can use filter(row_number() == n)
to extract a row of a tibble:
get_row <- function(dat, row) dat %>% filter(row_number() == row)
cars <- read_kaggle()
cars_1_8 <- cars %>% select(1:8)
get_row(dat = cars, row = 10)
# A tibble: 1 × 34
RefId IsBadBuy PurchDate Auction VehYear VehicleAge Make Model Trim SubModel
<dbl> <dbl> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr> <chr>
1 10 0 12/7/2009 ADESA 2007 2 FORD FIVE… SEL 4D SEDA…
# ℹ 24 more variables: Color <chr>, Transmission <chr>, WheelTypeID <chr>,
# WheelType <chr>, VehOdo <dbl>, Nationality <chr>, Size <chr>,
# TopThreeAmericanName <chr>, MMRAcquisitionAuctionAveragePrice <chr>,
# MMRAcquisitionAuctionCleanPrice <chr>,
# MMRAcquisitionRetailAveragePrice <chr>,
# MMRAcquisitonRetailCleanPrice <chr>, MMRCurrentAuctionAveragePrice <chr>,
# MMRCurrentAuctionCleanPrice <chr>, MMRCurrentRetailAveragePrice <chr>, …
get_row(dat = iris, row = 4)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 4.6 3.1 1.5 0.2 setosa