r - Convert a string of integers from input to array of integers -


i have string of integers input text box (in shiny) this:

input[["var1"]] "1,2,3,4" 

i want convert numeric vector like:

values <- c(1,2,3,4) 

any highly appreciated.

thanks, yes did make attempt earlier, , solved now. please find answer below.

a <- "1,2,3,4" [1] "1,2,3,4" input_values <- as.numeric(unlist(strsplit(a,","))) input_values [1] 1 2 3 4

thanks @ananda,

regards, ravijeet


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -