MYaseen208
MYaseen208

Reputation: 23898

R: Replacing quotes with blank spaces

I want to replace quotes with blank spaces and want to add comma.

test <- c("A", "B")
test
[1] "A" "B"
gsub(pattern=""", replacement=" " , x=test)

Desired Output

A, B

Upvotes: 0

Views: 1252

Answers (1)

A5C1D2H2I1M1N2O1R2T1
A5C1D2H2I1M1N2O1R2T1

Reputation: 193527

You may want to consider one of the following, but which is better would depend on what you are actually trying to achieve:

cat(test, sep = ", ")
# A, B
noquote(paste(test, collapse = ", "))
# [1] A, B

Upvotes: 2

Related Questions