forked from hrbrmstr/msgxtractr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
149 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Package: msgxtractr | ||
Type: Package | ||
Title: Read Outlook '.msg' Files | ||
Version: 0.2.1 | ||
Date: 2017-08-23 | ||
Version: 0.3.0 | ||
Date: 2020-05-06 | ||
Authors@R: c( | ||
person("Bob", "Rudis", email = "[email protected]", role = c("aut", "cre")), | ||
person("Ariya", "Hidayat", email = "[email protected]", role = c("ctb", "cph"), comment = "POLE library"), | ||
|
@@ -23,9 +23,10 @@ Suggests: | |
testthat, | ||
covr | ||
Depends: | ||
R (>= 3.2.0) | ||
R (>= 3.5.0) | ||
Imports: | ||
Rcpp, | ||
scales | ||
RoxygenNote: 6.1.1 | ||
scales, | ||
tibble | ||
RoxygenNote: 7.1.1 | ||
LinkingTo: Rcpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
S3method(as_tibble,msg) | ||
S3method(print,msg) | ||
export(decode_rtf) | ||
export(is_rtf) | ||
export(read_msg) | ||
export(save_attachments) | ||
export(tidy_msg) | ||
importFrom(Rcpp,sourceCpp) | ||
importFrom(scales,comma) | ||
importFrom(tibble,as_tibble) | ||
useDynLib(msgxtractr, .registration=TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
0.3.0 | ||
* Added `tidy_msg()` to turn a `msg` object into a `tibble` | ||
|
||
0.2.1 | ||
* Fixed issue #2 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#' Turn a single `msg` object into a `tibble` | ||
#' | ||
#' @param x a `msg` object | ||
#' @param ... passed on to [tibble::as_tibble()] | ||
#' @export | ||
tidy_msg <- function(x, ...) { | ||
|
||
x <- unclass(x) | ||
|
||
x <- x[lengths(x) > 0] | ||
|
||
for (idx in which(sapply(x, mode) == "list")) { | ||
x[[idx]] <- list(x[[idx]]) | ||
} | ||
|
||
tibble::as_tibble(x, ...) | ||
|
||
} | ||
|
||
#' @rdname tidy_msg | ||
#' @export | ||
as_tibble.msg <- tidy_msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
|
||
[![Build Status](https://travis-ci.org/hrbrmstr/msgxtractr.svg?branch=master)](https://travis-ci.org/hrbrmstr/msgxtractr) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/hrbrmstr/msgxtractr?branch=master&svg=true)](https://ci.appveyor.com/project/hrbrmstr/msgxtractr) [![codecov](https://codecov.io/gh/hrbrmstr/msgxtractr/branch/master/graph/badge.svg)](https://codecov.io/gh/hrbrmstr/msgxtractr) | ||
[![Build | ||
Status](https://travis-ci.org/hrbrmstr/msgxtractr.svg?branch=master)](https://travis-ci.org/hrbrmstr/msgxtractr) | ||
[![AppVeyor Build | ||
Status](https://ci.appveyor.com/api/projects/status/github/hrbrmstr/msgxtractr?branch=master&svg=true)](https://ci.appveyor.com/project/hrbrmstr/msgxtractr) | ||
[![codecov](https://codecov.io/gh/hrbrmstr/msgxtractr/branch/master/graph/badge.svg)](https://codecov.io/gh/hrbrmstr/msgxtractr) | ||
|
||
`msgxtractr` : Read Outlook '.msg' Files | ||
`msgxtractr` : Read Outlook ‘.msg’ Files | ||
|
||
'Microsoft' 'Outlook' messages can be saved in '.msg' files. Tools are provided that enable extraction of metadata, envelope, headers, body and attachments from these files. | ||
‘Microsoft’ ‘Outlook’ messages can be saved in ‘.msg’ files. Tools are | ||
provided that enable extraction of metadata, envelope, headers, body and | ||
attachments from these files. | ||
|
||
The following functions are implemented: | ||
|
||
- `read_msg`: Read in an Outlook '.msg' file | ||
- `save_attachments`: Save all attachments from a 'msg' object | ||
- `read_msg`: Read in an Outlook ‘.msg’ file | ||
- `save_attachments`: Save all attachments from a ‘msg’ object | ||
- `tidy_msg`: Turn a ‘msg’ object into a ‘tibble’ | ||
|
||
### Installation | ||
|
||
|
@@ -21,18 +28,18 @@ devtools::install_github("hrbrmstr/msgxtractr") | |
``` r | ||
library(msgxtractr) | ||
|
||
# current verison | ||
# current version | ||
packageVersion("msgxtractr") | ||
``` | ||
|
||
## [1] '0.2.1' | ||
## [1] '0.3.0' | ||
|
||
``` r | ||
str(msg1 <- read_msg(system.file("extdata/unicode.msg", package="msgxtractr"))) | ||
``` | ||
|
||
## List of 8 | ||
## $ headers :Classes 'tbl_df', 'tbl' and 'data.frame': 1 obs. of 18 variables: | ||
## $ headers : tibble [1 × 18] (S3: tbl_df/tbl/data.frame) | ||
## ..$ Return-path : chr "<[email protected]>" | ||
## ..$ Received :List of 1 | ||
## .. ..$ : chr [1:4] "from st11p00mm-smtpin007.mac.com ([17.172.84.240])\nby ms06561.mac.com (Oracle Communications Messaging Server "| __truncated__ "from mail-vc0-f182.google.com ([209.85.220.182])\nby st11p00mm-smtpin007.mac.com\n(Oracle Communications Messag"| __truncated__ "by mail-vc0-f182.google.com with SMTP id ie18so3484487vcb.13 for\n<[email protected]>; Mon, 18 Nov 2013 00:26:25 -0800 (PST)" "by 10.58.207.196 with HTTP; Mon, 18 Nov 2013 00:26:24 -0800 (PST)" | ||
|
@@ -217,26 +224,58 @@ str(msg4 <- read_msg(system.file("extdata/TestMessage-unicode.msg", package="msg | |
## ..$ last_mod_name: NULL | ||
## - attr(*, "class")= chr "msg" | ||
|
||
### Test Results | ||
``` r | ||
str(tidy_msg(msg1), 2) | ||
``` | ||
|
||
## tibble [1 × 8] (S3: tbl_df/tbl/data.frame) | ||
## $ headers :List of 1 | ||
## $ sender :List of 1 | ||
## $ recipients :List of 1 | ||
## $ subject : chr "Test for TIF files" | ||
## $ body :List of 1 | ||
## $ attachments :List of 1 | ||
## $ display_envelope:List of 1 | ||
## $ times :List of 1 | ||
|
||
``` r | ||
library(msgxtractr) | ||
library(testthat) | ||
str(tidy_msg(msg2), 2) | ||
``` | ||
|
||
date() | ||
## tibble [1 × 4] (S3: tbl_df/tbl/data.frame) | ||
## $ recipients :List of 1 | ||
## $ body :List of 1 | ||
## $ attachments:List of 1 | ||
## $ times :List of 1 | ||
|
||
``` r | ||
str(tidy_msg(msg3), 2) | ||
``` | ||
|
||
## [1] "Mon Aug 28 21:55:44 2017" | ||
## tibble [1 × 7] (S3: tbl_df/tbl/data.frame) | ||
## $ sender :List of 1 | ||
## $ recipients :List of 1 | ||
## $ subject : chr "New Message!" | ||
## $ body :List of 1 | ||
## $ attachments :List of 1 | ||
## $ display_envelope:List of 1 | ||
## $ times :List of 1 | ||
|
||
``` r | ||
test_dir("tests/") | ||
str(tidy_msg(msg4), 2) | ||
``` | ||
|
||
## ..........testthat results ======================================================================================================== | ||
## OK: 4 SKIPPED: 0 FAILED: 0 | ||
## | ||
## DONE =================================================================================================================== | ||
## tibble [1 × 7] (S3: tbl_df/tbl/data.frame) | ||
## $ sender :List of 1 | ||
## $ recipients :List of 1 | ||
## $ subject : chr "New Message!" | ||
## $ body :List of 1 | ||
## $ attachments :List of 1 | ||
## $ display_envelope:List of 1 | ||
## $ times :List of 1 | ||
|
||
### Code of Conduct | ||
|
||
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms. | ||
Please note that this project is released with a [Contributor Code of | ||
Conduct](CONDUCT.md). By participating in this project you agree to | ||
abide by its terms. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
Version: 1.0 | ||
RestoreWorkspace: Default | ||
SaveWorkspace: Default | ||
AlwaysSaveHistory: Default | ||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX | ||
StripTrailingWhitespace: Yes | ||
BuildType: Package | ||
PackageUseDevtools: Yes | ||
PackageInstallArgs: --no-multiarch --with-keep.source | ||
PackageBuildArgs: --resave-data | ||
PackageRoxygenize: rd,collate,namespace | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: Default | ||
SaveWorkspace: Default | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX | ||
|
||
StripTrailingWhitespace: Yes | ||
|
||
BuildType: Package | ||
PackageUseDevtools: Yes | ||
PackageInstallArgs: --no-multiarch --with-keep.source | ||
PackageBuildArgs: --resave-data | ||
PackageRoxygenize: rd,collate,namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters