I have a data.frame with several columns, all of them are character class. All values are in double quotes, I would like to remove those quotes.
Example
df1 df2
"1203" "Name1"
"2304" "Name2"
noquote() function in R Language is used to prints strings without quotes.
Just use "\"" or '"' to match a single double quote.
The print()
method for data frames has an option quote=
, which you can set to FALSE
:
print.data.frame(data.frame(x=c("Hello", "World")),
quote=FALSE)
# x
# 1 Hello
# 2 World
See also ?print.data.frame
(= help)
Edit:
With regards to the dput
ed data in the comment below:
as.data.frame(sapply(df, function(x) gsub("\"", "", x)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With