This example provides you with a way to create an output directory at the root of your R project and writes a csv and a pdf with the current date at the end of its name.

## Clear workspace
rm(list=ls())

## Seed for random number generation
set.seed(42)

## Set working directory to current path 
setwd(dirname(rstudioapi::getSourceEditorContext()$path))
# getwd()

## Reproducible example
df <- mtcars
output_dir = "./output"
proj_name = "projname"
name_raw = paste(output_dir, '/', proj_name, '_', gsub('-','',Sys.Date()), sep='')

## Create directory
dir.create(output_dir, showWarnings = T)

## Create csv
write.csv(df, paste(name_raw, ".csv", sep=''))

## Create pdf
pdf(file=paste(name_raw, ".pdf", sep=''), onefile = TRUE)
plot(df$cyl, df$mpg)
dev.off()

rm(output_dir, proj_name, name_raw)

## Save environment
save.image(paste(name_raw, ".RData", sep=''))