# Create temp file location
tmp <- file.path(tempdir(), "test.log")
# Open log
lf <- log_open(tmp)
# Write code to the log
log_code()
# Send message to log
log_print("High Mileage Cars Subset")
# Perform operations
hmc <- subset(mtcars, mtcars$mpg > 20)
# Print data to log
log_print(hmc)
# Close log
log_close()
# View results
writeLines(readLines(lf))
Run the code above in your browser using DataLab