diff --git a/inst/doc/how-to.R b/inst/doc/how-to.R index 21ad779..3519abe 100644 --- a/inst/doc/how-to.R +++ b/inst/doc/how-to.R @@ -38,18 +38,20 @@ plot(g, layout = igraph::layout.fruchterman.reingold(g), # emails_bengh <- get_emails(release = "Benghazi", save.dir = "./rodham", extractor = xpdf) ## ----download emails, echo=TRUE, eval=FALSE------------------------------ -# download_emails("August") # download specific release +# # download specific release +# dl <- download_emails("August") # returns full pass to zip # -# dir.create("emails_pdf") # create a directory to export pdf to +# pdf <- "emails_pdf" # directory where pdf will be extracted to +# txt <- "emails.text" # directory where txt will be extracted to # -# unzip("August.zip", exdir = "./emails_pdf") +# # create directories +# dir.create(pdf) +# dir.create(emails_bengh) # -# emails_bengh <- "./emails_text" # directory where we'll export .txt files -# -# dir.create(emails_bengh) # create directory +# unzip(dl, exdir = pdf) # # # get emails released in august -# extract_emails("emails_pdf", save.dir = emails_bengh, extractor = ext) +# extract_emails(pdf, save.dir = txt, extractor = ext) ## ----read emails, echo=TRUE, eval=FALSE---------------------------------- # contents <- load_emails(emails_bengh) @@ -58,9 +60,3 @@ plot(g, layout = igraph::layout.fruchterman.reingold(g), # cont <- get_content(contents) # cont <- clean_content(cont) -## ----get dates, echo=TRUE, eval=FALSE------------------------------------ -# dates <- load_emails(contents) - -## ----get addresses, echo=TRUE, eval=FALSE-------------------------------- -# addresses <- load_emails(contents) - diff --git a/inst/doc/how-to.Rmd b/inst/doc/how-to.Rmd index 1acba06..c0d1799 100644 --- a/inst/doc/how-to.Rmd +++ b/inst/doc/how-to.Rmd @@ -98,18 +98,20 @@ emails_bengh <- get_emails(release = "Benghazi", save.dir = "./rodham", extracto Alternatively you may want to proceed step by step. This is particularly useful if your temp folder requires super user or if you want to keep the pdf files. ```{r download emails, echo=TRUE, eval=FALSE} -download_emails("August") # download specific release +# download specific release +dl <- download_emails("August") # returns full pass to zip -dir.create("emails_pdf") # create a directory to export pdf to +pdf <- "emails_pdf" # directory where pdf will be extracted to +txt <- "emails.text" # directory where txt will be extracted to -unzip("August.zip", exdir = "./emails_pdf") +# create directories +dir.create(pdf) +dir.create(emails_bengh) -emails_bengh <- "./emails_text" # directory where we'll export .txt files - -dir.create(emails_bengh) # create directory +unzip(dl, exdir = pdf) # get emails released in august -extract_emails("emails_pdf", save.dir = emails_bengh, extractor = ext) +extract_emails(pdf, save.dir = txt, extractor = ext) ``` ## Load the emails @@ -126,21 +128,3 @@ You can clean the emails with `clean_content` it'll remove some comments and oth cont <- get_content(contents) cont <- clean_content(cont) ``` - -## helpers - -### Dates - -You can extract the dates from each email with `extract_date`. - -```{r get dates, echo=TRUE, eval=FALSE} -dates <- load_emails(contents) -``` - -### Addresses - -You can extract the dates from each email with `extract_address`. - -```{r get addresses, echo=TRUE, eval=FALSE} -addresses <- load_emails(contents) -``` diff --git a/inst/doc/how-to.html b/inst/doc/how-to.html index 3cb8de1..8fcfec8 100644 --- a/inst/doc/how-to.html +++ b/inst/doc/how-to.html @@ -153,7 +153,7 @@

Simple Network

vertex.size = log1p(igraph::degree(g)) * 2, edge.arrow.size = 0.1, edge.arrow.width = 0.1, edge.width = log1p(igraph::E(g)$freq)/4, vertex.frame.color="#FFFFFF") -

+

Get emails content

@@ -186,18 +186,20 @@

The fast way

Step by step

Alternatively you may want to proceed step by step. This is particularly useful if your temp folder requires super user or if you want to keep the pdf files.

-
download_emails("August") # download specific release
+
# download specific release
+dl <- download_emails("August") # returns full pass to zip
 
-dir.create("emails_pdf") # create a directory to export pdf to
+pdf <- "emails_pdf" # directory where pdf will be extracted to
+txt <- "emails.text" # directory where txt will be extracted to
 
-unzip("August.zip", exdir = "./emails_pdf")
+# create directories
+dir.create(pdf)
+dir.create(emails_bengh)
 
-emails_bengh <- "./emails_text" # directory where we'll export .txt files
-
-dir.create(emails_bengh) # create directory
+unzip(dl, exdir = pdf)
 
 # get emails released in august
-extract_emails("emails_pdf", save.dir = emails_bengh, extractor = ext)
+extract_emails(pdf, save.dir = txt, extractor = ext)
@@ -208,19 +210,6 @@

Load the emails

cont <- get_content(contents)
 cont <- clean_content(cont)
-
-

helpers

-
-

Dates

-

You can extract the dates from each email with extract_date.

-
dates <- load_emails(contents)
-
-
-

Addresses

-

You can extract the dates from each email with extract_address.

-
addresses <- load_emails(contents)
-
-
diff --git a/vignettes/how-to.Rmd b/vignettes/how-to.Rmd index ee70626..c0d1799 100644 --- a/vignettes/how-to.Rmd +++ b/vignettes/how-to.Rmd @@ -98,18 +98,20 @@ emails_bengh <- get_emails(release = "Benghazi", save.dir = "./rodham", extracto Alternatively you may want to proceed step by step. This is particularly useful if your temp folder requires super user or if you want to keep the pdf files. ```{r download emails, echo=TRUE, eval=FALSE} -download_emails("August") # download specific release +# download specific release +dl <- download_emails("August") # returns full pass to zip -dir.create("emails_pdf") # create a directory to export pdf to +pdf <- "emails_pdf" # directory where pdf will be extracted to +txt <- "emails.text" # directory where txt will be extracted to -unzip("August.zip", exdir = "./emails_pdf") +# create directories +dir.create(pdf) +dir.create(emails_bengh) -emails_bengh <- "./emails_text" # directory where we'll export .txt files - -dir.create(emails_bengh) # create directory +unzip(dl, exdir = pdf) # get emails released in august -extract_emails("emails_pdf", save.dir = emails_bengh, extractor = ext) +extract_emails(pdf, save.dir = txt, extractor = ext) ``` ## Load the emails