how to remove unwanted characters from data
Should have been posted in SO as others rightly pointed out. 

Simple solution would be to:


Split on '*' and select the first part of the split.
Apply (1) over list items and return a vector.

x &lt;- c("21,34,99*", "56,90*", "45*")               #test case

data_clean &lt;- function(x) sapply (strsplit(x , '[*]' ), `[` , 1)
data_clean(x)