Hi,
How can I get double quotes embedded in the string?
Example:
--
str1 - 'xyz'
## desired output
# abcxyz
qr2 - paste('abc',str1,sep='')
print(qr2)
-
Actual output:
[1] abc\str\
I also tried putting an escape sequence before the quote, but couldn't get the
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\xyz\
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
You can try noquote also:
noquote(paste('abc', 'xyz', sep = ))
On Wed, Jun 30, 2010 at 3:31 PM, Paul Evans p.evan...@yahoo.com wrote:
Hi,
How can I get double quotes embedded in the string?
Example:
--
str1 - 'xyz'
## desired output
# abcxyz
qr2 -
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 the
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 afterwards the
string m1,m2,m3
No problem to build the string
Will this do?
temp - paste(m, 1:3, sep=,collapse=,)
HTH,
baptiste
2009/12/23 Knut Krueger r...@krueger-family.de:
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 -
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 by , or
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 afterwards the
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,
Tuesday, Daylight
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
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)
length(temp) #getting the length
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 ted.hard...@manchester.ac.uk:
On 23-Dec-09 11:08:02, Knut Krueger wrote:
Jim Lemon schrieb:
Not as easy as I thought
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 sep in previous
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| a
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, December,Monday,Tuesday)
On Wed, Dec 23, 2009 at 11:21 AM, Knut Krueger r...@krueger-family.de 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
17 matches
Mail list logo