script_content <- 'library(rstudioapi)
ActiveDocument <- getActiveDocumentContext()$path
min_c <- min(c(1,2,3))
'
temp_script_path <- tempfile(fileext = ".R")
writeLines(script_content, con = temp_script_path)
libr_used(script = temp_script_path)
unlink(temp_script_path)
Run the code above in your browser using DataLab