#try to create 2d function

#this will be the function with the right working directory
rm(list=ls())
#this is the correct function that saves the data where it has to be saved 
source("2c.R")

save_jobs_to_csv <- function(searchterm, location, radius) {
  # Call the download_all_jobs function to fetch data
  jobs <- download_all_jobs(searchterm, location, radius)
  
  # Generate filename using the current date and specify the directory
  today <- Sys.Date()
  directory <- "/Users/alexanderunger/Desktop/AIDAHO_IDS_THAS/01_data/raw"
  filename <- paste0(directory, "/", today, "_jobs_daten_full.csv")  # Adjust path as necessary
  
  # Save the data frame to a CSV file in the specified directory
  write.csv(jobs, filename, row.names = FALSE)
  
  return(paste("File saved as:", filename))
}


save_jobs_to_csv("Daten", "Stuttgart", 100)



