'I am getting error, while moving files in r

I am trying to move some files from one location to another using below code:

#exclude files with name .maf
filez <- grep(list.files(path="."), pattern='.maf', invert=TRUE, value=TRUE) 
filez <- data.frame(filez)
#select files with sepcial chr at 14 & 15 position in file name
Tumor <- filez %>% filter(between(as.integer(substr(filez, 14, 15)), 01, 09)) 
dir.create("Tumor")
file.move(Tumor$filez, "Tumor")

However I getting error

file.move(Tumor$filez, "Tumor")
Error in argchk_move_files(files = files, destinations = destinations,  : 
  Assertion on 'files' failed: Must be of type 'character', not 'factor'.

I donot know why error is coming.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source