[R] spliting a string

Jim Lemon jim at bitwrit.com.au
Thu Jul 17 14:44:32 CEST 2008


On Thu, 2008-07-17 at 17:56 +0530, Kurapati, Ravichandra (Ravichandra)
wrote:
> Hi
> 
>  
> 
>      String<-"130.5"
> 
>      
> 
>     Df<-Strsplit(".",":",String)
> 
>  
> 
>      Then Df get 
> 
>        "" "" "" ""
> 
>     But I want Df should contains
> 
>  
> 
>    Df
> 
>   "130"
> 
>   "5"
> 
Hi Ravichandra,
Try:

strsplit(String,"[.]")

The period (full stop) has to be marked as literal.

Jim



More information about the R-help mailing list