[R] converting numeric into character strings
Olivier ETERRADOSSI
olivier.eterradossi at ema.fr
Wed May 13 12:55:57 CEST 2009
Hi Melissa
unless I miss a point, you should get what you want with (for example)
y<-paste(b,collapse=",")
Hope this helps. Olivier
Melissa2k9 wrote:
>
> Hi,
>
> Im trying to put some numbers into a dataframe , I have a list of numbers
> (change points in a time series) like such
>
> [1] 2 11 12 20 21 98 99
>
> but I want R to recognise this as just a character string so it will put
> it in one row and column, ideally I want them seperated by commas so I
> would have for example
>
> Person Change points (seconds)
> A 2,11,12,20,21,98,99
> B 4,5,89
>
> etc. Is there any way I can get this
>
> I've tried this:
>
> for example if the command to get the list of numbers was b<-which(a!=s),
> then i have tried
>
> as.character(b) but I just end up with
>
> [1] "2" "11" "12" "20" "21" "98" "99"
>
> which is not what I want as this is more than one string and is not
> seperated by commas, I also tried
>
> paste(b,sep=",") but I end up with the same thing. Sorry it's a bit
> confusing to read but any help would be great!
>
> Melissa
>
--
View this message in context: http://www.nabble.com/converting-numeric-into-character-strings-tp23518762p23519577.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list