File tree Expand file tree Collapse file tree 3 files changed +22
-23
lines changed Expand file tree Collapse file tree 3 files changed +22
-23
lines changed Original file line number Diff line number Diff line change @@ -38,17 +38,17 @@ merge_mbox_all <-
38
38
function (path = " ." , file = NULL ) { # Function starts:
39
39
40
40
if (length(list.files(path , pattern = " (*.mbox)$" )) > 0 ) {
41
- # if (path != ".") {
42
- # current_wd <- getwd()
43
- # setwd(path)
44
- # }
41
+ # if (path != ".") {
42
+ # current_wd <- getwd()
43
+ # setwd(path)
44
+ # }
45
45
46
46
multi_mbox <- list.files(path , pattern = " (*.mbox)$" ) %> %
47
47
purrr :: map_df(~ mboxr :: read_mbox(. ))
48
48
49
- # if (path != ".") {
50
- # setwd(current_wd)
51
- # }
49
+ # if (path != ".") {
50
+ # setwd(current_wd)
51
+ # }
52
52
53
53
if (! is.null(file )) {
54
54
fileExt <- tolower(tools :: file_ext(file ))
@@ -61,7 +61,7 @@ merge_mbox_all <-
61
61
}
62
62
}
63
63
64
- class(multi_mbox ) <- c(" mbox_df" , class(multi_mbox ))
64
+ class(multi_mbox ) <- c(" mbox_df" , class(multi_mbox ))
65
65
return (multi_mbox )
66
66
} else {
67
67
stop(" No mbox file is found in the current directory." )
Original file line number Diff line number Diff line change 3
3
4
4
# Remove carriage return and trim white spaces in subject line
5
5
trim_subject <- function (mbox_df ) {
6
- if (! inherits(mbox_df , " mbox_df" )) {
7
- stop(" You need an mbox_df object for this function: Convert your mbox file through `read_mbox()` first." )
8
- }
6
+ if (! inherits(mbox_df , " mbox_df" )) {
7
+ stop(" You need an mbox_df object for this function: Convert your mbox file through `read_mbox()` first." )
8
+ }
9
9
10
- mbox_df %> %
11
- dplyr :: mutate(subject = stringr :: str_replace_all(string = subject , pattern = " [[:cntrl:]]+" , replacement = " " )) %> %
12
- dplyr :: mutate(subject = stringr :: str_replace_all(string = subject , pattern = " [[:space:]]+" , replacement = " " ))
10
+ mbox_df %> %
11
+ dplyr :: mutate(subject = stringr :: str_replace_all(string = subject , pattern = " [[:cntrl:]]+" , replacement = " " )) %> %
12
+ dplyr :: mutate(subject = stringr :: str_replace_all(string = subject , pattern = " [[:space:]]+" , replacement = " " ))
13
13
}
14
-
Original file line number Diff line number Diff line change 30
30
# ' @author Soyoung Choi, \email{[email protected] }
31
31
32
32
num_thread <- function (mbox_df ) {
33
- if (! inherits(mbox_df , " mbox_df" )) {
34
- stop(" You need an mbox_df object for this function: Convert your mbox file through `read_mbox()` first." )
35
- }
33
+ if (! inherits(mbox_df , " mbox_df" )) {
34
+ stop(" You need an mbox_df object for this function: Convert your mbox file through `read_mbox()` first." )
35
+ }
36
36
37
37
mbox_df %> %
38
- is_thread() %> %
39
- sum(. , na.rm = TRUE )
38
+ is_thread() %> %
39
+ sum(. , na.rm = TRUE )
40
40
}
41
41
42
42
43
43
# ' @rdname num_thread
44
44
# ' @export
45
45
46
46
is_thread <- function (mbox_df ) {
47
- if (! inherits(mbox_df , " mbox_df" )) {
48
- stop(" You need an mbox_df object for this function: Convert your mbox file through `read_mbox()` first." )
49
- }
47
+ if (! inherits(mbox_df , " mbox_df" )) {
48
+ stop(" You need an mbox_df object for this function: Convert your mbox file through `read_mbox()` first." )
49
+ }
50
50
51
51
mbox_df $ num_discussants > 1
52
52
}
You can’t perform that action at this time.
0 commit comments