[R] strsplit on comma, with a trailing comma in input

dankelley Dan.Kelley at dal.ca
Tue Dec 4 01:19:57 CET 2007


This works perfectly.  Thanks!


Peter Dalgaard wrote:
> 
>>   
> Hmm, I don't think strsplit can do that. However:
> 
>  > scan(textConnection("a,,b,"), sep=",", what="")
> Read 4 items
> [1] "a" ""  "b" ""
> 
> -- 
>    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>  (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45)
> 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45)
> 35327907
> 
> ______________________________________________
> R-help at 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/strsplit-on-comma%2C-with-a-trailing-comma-in-input-tf4940023.html#a14142103
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list