[R] convert a Character-string to a number

Kenneth Cabrera krcabrer at unalmed.edu.co
Fri Sep 12 14:56:34 CEST 2003


Try

as.numeric(gsub(",",".",a))


Hope it helps!!


Best regards

Kenneth

On Fri, 12 Sep 2003 14:29:13 +0200, Michael Kirschbaum <emkiba at gmx.de> 
wrote:

> Hi Everyone.
>
> I have a simple problem but don't know, how to get along.
>
> how can I convert the vector
>
> a<-c("0,01","1,00")
> in a vector b<-c(0.01,1.00)
>
> Thank you for suggestions
>
> M.Kirschbaum
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>



--




More information about the R-help mailing list