Remove quotation marks from string


#1

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,


#2

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).


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

#4

Thank you cderv and DavoWW for your help.