-1

I am trying to parse a string to use as an argument. It throws the following error.

Error in parse: <text>:1:10: unexpected ','

This is the part of my code:

type <- input$info_type
arguments <- paste(type, collapse=", ")
tmp <- rbind(eval(parse(text=arguments)))

input$info_type is an input from Selectize, and I expect the code to work like this: if: argument <- "data_1, data_2" then, execute: rbind(data_1, data_2)

jay.sf
  • 60,139
  • 8
  • 53
  • 110
Luciano
  • 7
  • 2
  • Possible duplicate of [Evaluate expression given as a string](https://stackoverflow.com/questions/1743698/evaluate-expression-given-as-a-string) – Raidri Jun 18 '19 at 11:52

1 Answers1

0

Library(stringr)

arguments = str_c(string = input$info_type, collapse=", ")

or

arguments = input %>% paste(type, collapse=", ")

vaibhav krishna
  • 267
  • 2
  • 4
  • When I assign `arguments` as the ones you suggested and do `rbind(arguments)`, it just returns the `arguments` string itself, like `selection1,selection2,selection3` – Luciano Jun 18 '19 at 11:50