library(petro.One)
library(tm)

my_url <- make_search_url(query = "Permanent Downhole Gauge", 
                          how = "all")        

get_papers_count(my_url)    # how many papers total
papers_by_type(my_url)      # papers by type

# create a dataframe of papers found
df <- read_multidoc(my_url)
df
library(petro.One)

tf <- term_frequency(df)
tf
plot_wordcloud(tf, min.freq = 20)
library(petro.One)

# plot two-grams
# tf2 <- term_frequency_deep(df)
tf2 <- term_frequency_n_grams(df, gram.min = 2, gram.max = 2)
tf2
# plot 2-grams
plot_wordcloud(tf2, min.freq = 5)
library(petro.One)
plot_bars(tf2, min.freq = 10)
new_url <- make_search_url(query = "Permanent Downhole Gauge", 
                          how = "all") 
library(petro.One)

# plot two-grams
# tf2 <- term_frequency_deep(df)
tf3 <- term_frequency_n_grams(df, gram.min = 3, gram.max = 3)
tf3
library(petro.One)
plot_bars(tf3, min.freq = 3)
library(petro.One)

# plot two-grams
tf4 <- term_frequency_n_grams(df, gram.min = 4, gram.max = 4)
tf4
plot_bars(tf4, min.freq = 2)
library(petro.One)

# plot two-grams
tf12 <- term_frequency_n_grams(df, gram.min = 1, gram.max = 2)
tf12
plot_bars(tf12, min.freq = 20)

dendogram

TDM <- get_term_document_matrix(df)
tdm <- TDM$tdm
library(graph)
library(Rgraphviz)

#inspect frequent words
freq.terms <- findFreqTerms(tdm, lowfreq=30)
plot(tdm, term = freq.terms, corThreshold = 0.10, weighting = T)


f0nzie/petro.One documentation built on May 29, 2019, 12:05 a.m.