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 -

dataset - MPAndroidchart returning no chart Data available -

post - imageshack API cURL -