Dear Melissa, Try this: > x <- c(2, 11, 12, 20, 21, 98, 99) > paste(x, collapse=",") [1] "2,11,12,20,21,98,99"
See ?paste for more information. HTH, Jorge On Wed, May 13, 2009 at 5:53 AM, Melissa2k9 <m.mcquil...@lancaster.ac.uk>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-tp23518762p23518762.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.