[R] Get a subset

Sarah Goslee sarah.goslee at gmail.com
Mon Mar 12 17:44:39 CET 2012


You can use gsub() to delete all the characters after the first
semicolon by replacing them with "". If you provide the requested
reproducible example, I imagine someone will provide you with working
code, if reading the help for gsub() isn't enough to get you going.

Sarah

On Mon, Mar 12, 2012 at 12:27 PM, stella <dorotheabusse at yahoo.de> wrote:
> Hi,
> I have a list of names (alphanumeric characters) and each row by itself
> contains a different number of names seperated by a semicolon (";"). There
> are also rows with no entry. I would like to have the name before the first
> semicolon in each row, if there is any entry. Does anyone have an idea how
> to solve this in R?
>
> Thank you!
>  Stella
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Get-a-subset-tp4466541p4466541.html
> Sent from the R help mailing list archive at Nabble.com.
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list