Add perl = TRUE

On Sat, Mar 14, 2009 at 5:42 AM, Daren Tan <darenta...@gmail.com> wrote:
> I am cleaning up comma-limited values, so that only one comma
> separates each value. Using the example below, as much as I try with
> regex, I can't remove the last comma. I hope to have a one-liner
> solution, if possible.
>
> gsub("^,*|,*$|(,)*", "\\1", ",,,apple,,orange,,,,,lemon,strawberry,,,,")
> [1] "apple,orange,lemon,strawberry,"

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to