In R, I need to copy the files listed in a vector into the folders listed in another vector in a one-to-one correspondence.
In the example below, I want sc1.png to be copied into the test1 folder and sc2.png into the test2 folder.
I tried this, but it didn't work:
files <- c("~/Desktop/test/sc1.png", "~/Desktop/test/sc2.png")
dirs <- c("~/Desktop/test/test1", "~/Desktop/test/test2")
file.copy(files, dirs)
I'd appreciate any help. Thanks.