Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

save link tweet in new column in R

library(stringr)

url_pattern <- "http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"

data$ContentURL <- str_extract(data$Content, url_pattern)

data

##                                            Content       date              ContentURL
## 1               a house a home https://www.foo.com 12/31/2013     https://www.foo.com
## 2 cabin ideas https://www.example.com in the woods   5/4/2013 https://www.example.com
## 3                                 motel is a hotel   1/4/2013                    <NA>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #save #link #tweet #column #R
ADD COMMENT
Topic
Name
4+3 =