[R] integer vector to a string

Søren Merser merser at image.dk
Wed May 10 21:28:03 CEST 2006


yes, of cause,  i'm sorry, don't what i was thinking about
regards
----- Original Message ----- 
From: "Peter Dalgaard" <p.dalgaard at biostat.ku.dk>
To: "Søren Merser" <merser at image.dk>
Cc: "R - help" <r-help at stat.math.ethz.ch>
Sent: Wednesday, May 10, 2006 9:06 PM
Subject: Re: [R] integer vector to a string


> Søren Merser <merser at image.dk> writes:
>
>> hi there
>> is there a way that i can coerce a vector of integers to ONE  string with
>> the numbers comma separated like:
>> 1:500  ->    "1,2,3, ..., 500"
>>
>> i've tried deparse, but it divides the result into a vector of string
>> (depending on the setting of width with a max of 500)
>
> paste(1:500, collapse=",")
>
> -- 
>   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
> (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 
> 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 
> 35327907




More information about the R-help mailing list