Description Usage Arguments Value Examples
Replaces Twitter style handle tags (e.g., '@trinker').
1 | replace_tag(x, pattern = qdapRegex::grab("rm_tag"), replacement = "", ...)
|
x |
The text variable. |
pattern |
Character time regex string to be matched in the given character vector. |
replacement |
A function to operate on the extracted matches or a character string which is a replacement for the matched pattern. |
... |
ignored. |
Returns a vector with tags replaced.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | x <- c("@hadley I like #rstats for #ggplot2 work.",
"Difference between #magrittr and #pipeR, both implement pipeline operators for #rstats:
http://renkun.me/r/2014/07/26/difference-between-magrittr-and-pipeR.html @timelyportfolio",
"Slides from great talk: @ramnath_vaidya: Interactive slides from Interactive Visualization
presentation #user2014. http://ramnathv.github.io/user2014-rcharts/#1"
)
replace_tag(x)
replace_tag(x, replacement = '<<TAG>>')
replace_tag(x, replacement = '$3')
## Replacement with a function
replace_tag(x,
replacement = function(x){
gsub('@', ' <<TO>> ', x)
}
)
|
[1] " I like #rstats for #ggplot2 work."
[2] "Difference between #magrittr and #pipeR, both implement pipeline operators for #rstats: \n http://renkun.me/r/2014/07/26/difference-between-magrittr-and-pipeR.html "
[3] "Slides from great talk: : Interactive slides from Interactive Visualization \n presentation #user2014. http://ramnathv.github.io/user2014-rcharts/#1"
[1] "<<TAG>> I like #rstats for #ggplot2 work."
[2] "Difference between #magrittr and #pipeR, both implement pipeline operators for #rstats: \n http://renkun.me/r/2014/07/26/difference-between-magrittr-and-pipeR.html <<TAG>>"
[3] "Slides from great talk: <<TAG>>: Interactive slides from Interactive Visualization \n presentation #user2014. http://ramnathv.github.io/user2014-rcharts/#1"
[1] "hadley I like #rstats for #ggplot2 work."
[2] "Difference between #magrittr and #pipeR, both implement pipeline operators for #rstats: \n http://renkun.me/r/2014/07/26/difference-between-magrittr-and-pipeR.html timelyportfolio"
[3] "Slides from great talk: ramnath_vaidya: Interactive slides from Interactive Visualization \n presentation #user2014. http://ramnathv.github.io/user2014-rcharts/#1"
[1] " <<TO>> hadley I like #rstats for #ggplot2 work."
[2] "Difference between #magrittr and #pipeR, both implement pipeline operators for #rstats: \n http://renkun.me/r/2014/07/26/difference-between-magrittr-and-pipeR.html <<TO>> timelyportfolio"
[3] "Slides from great talk: <<TO>> ramnath_vaidya: Interactive slides from Interactive Visualization \n presentation #user2014. http://ramnathv.github.io/user2014-rcharts/#1"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.