Remove quotation marks from string

Hello,
let's say that the files i read from input in a list contain quotes: example "path/filename/.txt". How can eliminate the quotes and convert it to path/filename.txt

Thanks,

You can use gsub

string <- '"path/filename/.txt"'
string
#> [1] "\"path/filename/.txt\""
gsub('"', '', string)
#> [1] "path/filename/.txt"

Created on 2018-08-29 by the reprex package (v0.2.0).

4 Likes
file1 <- "path/filename/.txt"
file1
noquote(file1)
3 Likes

Thank you cderv and DavoWW for your help.