[R] How to send Html using SQL Server db mail

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Aug 20 19:36:54 CEST 2008


2008/8/20 Bos, Roger <roger.bos at us.rothschild.com>:
> All,
>
> I have a variable called `go` and it has a single quote in the name
> column of line 47 that I am trying to get rid of.  I have tried using
> gsub, but I cannot get the syntax correct to tell R to remove the '
> (single quote).
>
>> go[47,]
>    gvkey Symbol                    Name   Rank MarketCap MemoDate
> Action Analyst Reason SharesHeld
> 75 065105     BJ BJ'S WHOLESALE CLUB INC 0.9579   2258.24     <NA>
> <NA>    <NA>   <NA>       <NA>
>>
>
> I have tried every combination I could think of, some of them being:
> gsub(go, `'`, ` `)
> gsub(go, "'", " ")
> gsub(go, "\'S", " S")
> gsub(go, "'S", "S")

 Did you try reading the help for gsub?

 > s="Mom's Friendly Robot Company"
 > gsub("'","",s)
 [1] "Moms Friendly Robot Company"

 It's gsub(pattern, replacement, x), not gsub(x,pattern,replacement).

If this still fails for you then it's possible the ' mark in your text
isn't an ascii ' but some other mark that looks like an ascii '.
There's a lot of them about.

What's this got to do with "How to send Html using SQL Server db
mail"? If you use a meaningful subject then more people will read it.
Except for weirdos like me who read stuff with odd subjects anyway...

Barry



More information about the R-help mailing list