-1

I have the following data in c.

c <- "'1WK4166', 'ULTQVY8', 'TZDNZX0', '895K3D8', 'RG1NSW9', 'BH73P1', 'WQ9J84'"

I am trying to paste the exact output but I don't want the first and last quotiation ("") and want the whole string to be in brackets. as such

('1WK4166', 'ULTQVY8', 'TZDNZX0', '895K3D8', 'RG1NSW9', 'BH73P1', 'WQ9J84')

The reason I am asking is that I am pasting this into an SQL Query.

Rui Barradas
  • 70,273
  • 8
  • 34
  • 66
user8491385
  • 413
  • 1
  • 5
  • 17
  • I have no clue what R is but assume that it must have a `replace` or similar. A quick google found this possible duplicate of [**In R, replace text within a string**](https://stackoverflow.com/questions/11936339/in-r-replace-text-within-a-string) – Nope Oct 02 '17 at 10:24
  • The opening and closing `"` appear to be the quotes that display in printing the string and I would not expect them to be included in any pasting you do. Using `paste0("(", c, ")")` will likely work. I can't be sure, though; your code is not valid R code, so I'm not completely sure what you are doing. – Benjamin Oct 02 '17 at 10:35

1 Answers1

0

Assuming you are will literally ctrl+c->ctrl+v the query direct from the console to your query window..

cat("(",c,")",sep="")

..will display the string with brackets and no quotes.

Jul
  • 1,129
  • 6
  • 12