Skip to contents

This function retrieves the book_id values from the input_data and saves them to a specified text file.

Usage

get_book_ids(input_data, file_name)

Arguments

input_data

A data frame containing a column named book_id.

file_name

A string specifying the name of the text file to save the book_id values.

Value

No return value, the function writes the book_id values to a text file.

Examples

# Create sample data
books <- data.frame(title = c("Hamlet", "The Hunger Games", "Jane Eyre"),
                    book_id = c("1420", "2767052", "10210")
                    )
# Create a temporary file path
temp_file <- file.path(tempdir(), "bookids.txt")

# Run the function
get_book_ids(books, temp_file)
#> Book IDs saved to /tmp/Rtmp8flXPX/bookids.txt

# Clean up: remove the temporary file
file.remove(temp_file)
#> [1] TRUE