Skip to content
Back to formatted view

Raw Message

Message-ID: <47CD54AB.8060306@icr.ac.uk>
Date: 2008-03-04T13:54:51Z
From: Daniel Brewer
Subject: Best way to strsplit a column

Hello,

I have a data.frame with a column that I would like to split into based 
around the delimiter ":".  This is a useful feature in Excel.  I cannot 
work out the best way to do it in R.  I am sure you need to use 
strsplit, but that returns a list.  The problem is that some values in 
the column do not contain a ":" so should have a "NA" in the second 
column of the result, and this makes doing an unlist a non-starter.

Any ideas?

Many thanks

Daniel Brewer

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the a...{{dropped:2}}