-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
133 lines (69 loc) · 2.51 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
output: github_document
---
```{r, include=FALSE}
options("width"=101)
tmp <- devtools:::read_dcf("r_package/DESCRIPTION")
```
```{r, results='asis', echo=FALSE}
cat("#", tmp$Title)
```
**Status**
[![Travis-CI Build Status](https://travis-ci.org/petermeissner/diffr.svg?branch=master)](https://travis-ci.org/petermeissner/diffr)
[![codecov](https://codecov.io/gh/petermeissner/diffr/branch/master/graph/badge.svg)](https://codecov.io/gh/petermeissner/diffr/tree/master/R)
```{r, include=FALSE}
filelist.R <- list.files("r_package/R", recursive = TRUE, pattern="\\.[rR]$", ignore.case = TRUE, full.names = TRUE)
filelist.tests <- list.files("r_package/tests", recursive = TRUE, pattern="\\.[rR]$", ignore.case = TRUE, full.names = TRUE)
filelist.cpp <- list.files("r_package/src", recursive = TRUE, pattern="\\.cpp$", ignore.case = TRUE, full.names = TRUE)
lines.R <- unlist(lapply(filelist.R, readLines))
lines.tests <- unlist(lapply(filelist.tests, readLines))
lines.cpp <- unlist(lapply(filelist.cpp, readLines))
length.R <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.R, value = TRUE, invert = TRUE))
length.tests <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.tests, value = TRUE, invert = TRUE))
length.cpp <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.cpp, value = TRUE, invert = TRUE))
```
*lines of R code:* `r length.R`, *lines of C++ code:* `r length.cpp`, *lines of test code:* `r length.tests`
**Version**
```{r, results='asis', echo=FALSE}
cat(tmp$Version)
```
**Description**
```{r, results='asis', echo=FALSE}
cat(tmp$Description)
```
**License**
```{r, results='asis', echo=FALSE}
cat(tmp$License, "<br>")
cat(tmp$Author)
```
**Citation**
```{r, results='asis', echo=FALSE}
citation("diffr")
```
**BibTex for citing**
```{r, eval=FALSE}
toBibtex(citation("diffr"))
```
**Installation**
```{r, eval=FALSE}
remotes::install_github("petermeissner/diffr/r_package")
```
**Links**
- http://www.polver.uni-konstanz.de/sieberer/forschung/
- http://link.springer.com/article/10.1007%2Fs12286-014-0216-7
**Example Usage**
```{r set-options, echo=FALSE, cache=FALSE}
options(width = 160)
```
```{r, fig.asp=1.5}
require(diffr)
res <- diffr(example_A1_split, example_A2_split,
clean="none", dist="levenwords", sortDF=0)
names(res)
# total difference between both texts:
sum(res$alignment_df$dist, na.rm=T)
# alignment of texts
head(res$alignment_df)
# alignment of texts with texts
res$print
```