Re: [R] string question

2010-06-30 Thread Henrique Dallazuanna
You can try noquote also: noquote(paste('abc', '"xyz"', sep = "")) On Wed, Jun 30, 2010 at 3:31 PM, Paul Evans wrote: > Hi, > > How can I get double quotes embedded in the string? > > Example: > > -- > str1 <- '"xyz"' > > ## desired output > # abc"xyz" > > qr2 <- paste('abc',str1,s

Re: [R] string question

2010-06-30 Thread Peter Ehlers
cat() is probably what you want, but note that print() has a 'quote=' argument that you could set to FALSE: print(qr2, quote = FALSE) See ?print.default -Peter Ehlers On 2010-06-30 13:16, Phil Spector wrote: Paul - When you print a string, it escapes the quotes with a backslash. That's a

Re: [R] string question

2010-06-30 Thread Phil Spector
Paul - When you print a string, it escapes the quotes with a backslash. That's a property of the print() function, not the string itself. If you want to see the string, use cat(). The nchar() function is also useful: str1 <- '"xyz"' qr2 <- paste('abc',str1,sep='') print(qr2) [1] "abc\

Re: [R] String question

2009-12-26 Thread Peter Dalgaard
Knut Krueger wrote: Will this do? temp <- paste("m", 1:3, sep="",collapse=",") Unfortunately not, because I explained the example not detailed enough. The string could have different Items, like November, December, Monday, Tuesday, Daylight and so on Therefore I must count the Items of t

Re: [R] String question

2009-12-23 Thread Gustaf Rydevik
On Wed, Dec 23, 2009 at 11:21 AM, Knut Krueger wrote: > Hi to all > > I need a string like > temp <- paste("m1","m2","m3",sep=",") > But i must know how many items are in the string,afterwards > the other option would be to use a vector > temp <- c("m1","m2","m3") > No problem to get the count of

Re: [R] String question

2009-12-23 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 23.12.2009 12:08:02: > Jim Lemon schrieb: > > > > Not as easy as I thought it would be, but: > > > > mlist<-as.list(paste("m",1:sample(5:10,1),sep="")) > > do.call("paste",c(mlist,sep=",")) > > > > Hi Jim, > yes it works :-) > > temp <- c("November",

Re: [R] String question

2009-12-23 Thread Knut Krueger
Hi Baptiste, Isn't paste doing exactly this? yes indeed - surprising temp <- c("November", "December","Monday","Tuesday") paste(temp, collapse=",") paste(temp, sep=",") I tried to use sep :-( Arguments |...| one or more *R* objects, to be converted to character vectors. |sep|

Re: [R] String question

2009-12-23 Thread Ted Harding
On 23-Dec-09 11:40:12, baptiste auguie wrote: > Isn't paste doing exactly this? > > temp <- c("November", "December","Monday","Tuesday") > paste(temp, collapse=",") ># "November,December,Monday,Tuesday" > > HTH, > baptiste Yes, spot-on! I got involved in the confusion resulting from the use of "

Re: [R] String question

2009-12-23 Thread baptiste auguie
Isn't paste doing exactly this? temp <- c("November", "December","Monday","Tuesday") paste(temp, collapse=",") # "November,December,Monday,Tuesday" HTH, baptiste 2009/12/23 Ted Harding : > On 23-Dec-09 11:08:02, Knut Krueger wrote: >> Jim Lemon schrieb: >>> Not as easy as I thought it would be

Re: [R] String question

2009-12-23 Thread Ted Harding
On 23-Dec-09 11:08:02, Knut Krueger wrote: > Jim Lemon schrieb: >> Not as easy as I thought it would be, but: >> >> mlist<-as.list(paste("m",1:sample(5:10,1),sep="")) >> do.call("paste",c(mlist,sep=",")) > > Hi Jim, > yes it works :-) > > temp <- c("November", "December","Monday","Tuesday") > le

Re: [R] String question

2009-12-23 Thread Knut Krueger
Jim Lemon schrieb: Not as easy as I thought it would be, but: mlist<-as.list(paste("m",1:sample(5:10,1),sep="")) do.call("paste",c(mlist,sep=",")) Hi Jim, yes it works :-) temp <- c("November", "December","Monday","Tuesday") length(temp) #getting the length of the vector string1=do.call("p

Re: [R] String question

2009-12-23 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 23.12.2009 11:46:31: > > > Will this do? > > > > temp <- paste("m", 1:3, sep="",collapse=",") > > > > > Unfortunately not, because I explained the example not detailed enough. > The string could have different Items, like November, December, Monday,

Re: [R] String question

2009-12-23 Thread Jim Lemon
On 12/23/2009 09:21 PM, Knut Krueger wrote: Hi to all I need a string like temp <- paste("m1","m2","m3",sep=",") But i must know how many items are in the string,afterwards the other option would be to use a vector temp <- c("m1","m2","m3") No problem to get the count of items but I must get aft

Re: [R] String question

2009-12-23 Thread Knut Krueger
Will this do? temp <- paste("m", 1:3, sep="",collapse=",") Unfortunately not, because I explained the example not detailed enough. The string could have different Items, like November, December, Monday, Tuesday, Daylight and so on Therefore I must count the Items of the string separated b

Re: [R] String question

2009-12-23 Thread baptiste auguie
Will this do? temp <- paste("m", 1:3, sep="",collapse=",") HTH, baptiste 2009/12/23 Knut Krueger : > Hi to all > > I need a string like > temp <- paste("m1","m2","m3",sep=",") > But i must know how many items are in the string,afterwards > the other option would be to use a vector > temp <- c("