0

I am using a function in R which needs a folder named "yearXXXX" (the current year) to save the output there.

The code looks like this (The OS is macOS):

    function (lastday, current_year) 
{    
    system("rsync --remove-source-files -avh year2013 year2013_backup")
    system("mkdir year2013")
    system("ls temp > foo")
    dayfiles <- scan("foo", "")
    for (j in 1:length(dayfiles)) 
    {
    another function
    }

And the question is how to use the current_year parameter (which is for example 2013 or 2014 and is set when you want to run the function) for setting the folder name according to the year in use.

Thanks

3
  • 2
    system(paste0("mkdir year", current_year)) Commented Jan 11, 2018 at 11:39
  • 1
    stackoverflow.com/a/4216864/1412059 Commented Jan 11, 2018 at 11:40
  • Thanks `@LyzandeR´ I will let know if this work out for me. About the other question i'm sorry I'm statting use Stack and i could not find it before. Commented Jan 12, 2018 at 10:42

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.