├── NEWS.md ├── exec ├── sourced.R ├── loader.R ├── micro.R ├── simple_script.R ├── messycode.R └── micro_R.json ├── inst ├── example │ ├── projects │ │ ├── 2016 │ │ │ ├── june_biomass_survey.csv │ │ │ ├── old_data │ │ │ │ └── july_biomass_survey.csv │ │ │ └── july_biomass_survey.csv │ │ ├── data_forestplot │ │ │ ├── dataset_v2_june_from_collaboraotr1.csv │ │ │ ├── save1.csv │ │ │ ├── dataset_v1.csv │ │ │ └── dataset_v2_june_from_collaborator1.csv │ │ ├── table_2.csv │ │ └── lm_table_1.txt │ ├── micro.R │ ├── simple_script.R │ └── prov_micro.json └── README.rmd ├── tests ├── testthat.R └── testthat │ ├── s.test.rda │ ├── lib.test.rda │ ├── libs.test.rda │ ├── opt.test.rda │ ├── pi.test.rda │ ├── prov.test.rda │ ├── rmd.file.rda │ ├── sp.test.rda │ ├── vl.test.rda │ ├── prov.g.test.rda │ ├── read.prov.test │ ├── rp.clean.y.rda │ ├── var.id.test.rda │ ├── codeGraph.src.rda │ ├── rp.clean.x.test.rda │ ├── rp.clean.y.test.rda │ ├── rp.options.test.rda │ ├── write.code.test.rda │ ├── clean.simple.out.test.rda │ ├── format.simple.out.test.rda │ ├── micro.R │ ├── simple_script.R │ ├── lib_test.R │ ├── test-deps.R │ ├── test-main.R │ └── micro_R.json ├── data └── prov_json.rda ├── example ├── micro.R ├── simple_script.R └── prov_micro.json ├── vignettes ├── example │ ├── micro.R │ ├── simple_script.R │ └── prov_micro.json └── Rclean.rmd ├── .Rbuildignore ├── codecov.yml ├── man ├── prov_json.Rd ├── codeGraph.Rd ├── get.libs.Rd ├── parse.info.Rd ├── read.prov.Rd ├── parse.graph.Rd ├── write.code.Rd ├── get.spine.Rd ├── var.lineage.Rd ├── p.spine.Rd └── clean.Rd ├── .travis.yml ├── .gitignore ├── NAMESPACE ├── cran-comments.md ├── DESCRIPTION ├── R ├── codeGraph.R ├── read.prov.R ├── get.spine.R ├── var.id.R ├── parse.info.R ├── get.libs.R ├── write.code.R ├── p.spine.R ├── parse.graph.R ├── var.lineage.R └── clean.R ├── CONTRIBUTE.md ├── ropensci └── presub_inq.md ├── joss ├── paper.md └── paper.bib ├── README.md └── LICENSE /NEWS.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exec/sourced.R: -------------------------------------------------------------------------------- 1 | 2+2 2 | -------------------------------------------------------------------------------- /inst/example/projects/2016/june_biomass_survey.csv: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /inst/example/projects/2016/old_data/july_biomass_survey.csv: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | test_check("Rclean") 3 | 4 | -------------------------------------------------------------------------------- /inst/example/projects/data_forestplot/dataset_v2_june_from_collaboraotr1.csv: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/prov_json.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/data/prov_json.rda -------------------------------------------------------------------------------- /tests/testthat/s.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/s.test.rda -------------------------------------------------------------------------------- /tests/testthat/lib.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/lib.test.rda -------------------------------------------------------------------------------- /tests/testthat/libs.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/libs.test.rda -------------------------------------------------------------------------------- /tests/testthat/opt.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/opt.test.rda -------------------------------------------------------------------------------- /tests/testthat/pi.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/pi.test.rda -------------------------------------------------------------------------------- /tests/testthat/prov.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/prov.test.rda -------------------------------------------------------------------------------- /tests/testthat/rmd.file.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/rmd.file.rda -------------------------------------------------------------------------------- /tests/testthat/sp.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/sp.test.rda -------------------------------------------------------------------------------- /tests/testthat/vl.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/vl.test.rda -------------------------------------------------------------------------------- /tests/testthat/prov.g.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/prov.g.test.rda -------------------------------------------------------------------------------- /tests/testthat/read.prov.test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/read.prov.test -------------------------------------------------------------------------------- /tests/testthat/rp.clean.y.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/rp.clean.y.rda -------------------------------------------------------------------------------- /tests/testthat/var.id.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/var.id.test.rda -------------------------------------------------------------------------------- /exec/loader.R: -------------------------------------------------------------------------------- 1 | deps <- c("Rclean", "provR", "igraph", "formatR") 2 | sapply(deps, require, character.only = TRUE) 3 | -------------------------------------------------------------------------------- /tests/testthat/codeGraph.src.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/codeGraph.src.rda -------------------------------------------------------------------------------- /tests/testthat/rp.clean.x.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/rp.clean.x.test.rda -------------------------------------------------------------------------------- /tests/testthat/rp.clean.y.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/rp.clean.y.test.rda -------------------------------------------------------------------------------- /tests/testthat/rp.options.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/rp.options.test.rda -------------------------------------------------------------------------------- /tests/testthat/write.code.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/write.code.test.rda -------------------------------------------------------------------------------- /tests/testthat/clean.simple.out.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/clean.simple.out.test.rda -------------------------------------------------------------------------------- /tests/testthat/format.simple.out.test.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/Rclean/master/tests/testthat/format.simple.out.test.rda -------------------------------------------------------------------------------- /exec/micro.R: -------------------------------------------------------------------------------- 1 | x<- 1 2 | y <-3 3 | 10 4 | x 5 | x <-x+y 6 | x 7 | y^3 8 | write.csv(x,"~/test.test") 9 | 10 | pdf("~/test.pdf") 11 | plot(x) 12 | dev.off() 13 | -------------------------------------------------------------------------------- /example/micro.R: -------------------------------------------------------------------------------- 1 | x<- 1 2 | y <-3 3 | 10 4 | x 5 | x <-x+y 6 | x 7 | y^3 8 | write.csv(x,"~/test.test") 9 | 10 | pdf("~/test.pdf") 11 | plot(x) 12 | dev.off() 13 | -------------------------------------------------------------------------------- /inst/example/micro.R: -------------------------------------------------------------------------------- 1 | x<- 1 2 | y <-3 3 | 10 4 | x 5 | x <-x+y 6 | x 7 | y^3 8 | write.csv(x,"~/test.test") 9 | 10 | pdf("~/test.pdf") 11 | plot(x) 12 | dev.off() 13 | -------------------------------------------------------------------------------- /tests/testthat/micro.R: -------------------------------------------------------------------------------- 1 | x<- 1 2 | y <-3 3 | 10 4 | x 5 | x <-x+y 6 | x 7 | y^3 8 | write.csv(x,"~/test.test") 9 | 10 | pdf("~/test.pdf") 11 | plot(x) 12 | dev.off() 13 | -------------------------------------------------------------------------------- /vignettes/example/micro.R: -------------------------------------------------------------------------------- 1 | x<- 1 2 | y <-3 3 | 10 4 | x 5 | x <-x+y 6 | x 7 | y^3 8 | write.csv(x,"~/test.test") 9 | 10 | pdf("~/test.pdf") 11 | plot(x) 12 | dev.off() 13 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^codecov\.yml$ 2 | CONTRIBUTE.md 3 | cran-comments.md 4 | .travis.yml 5 | cleanR-demo.gif 6 | cleanR_demo_vid.png 7 | ^exec/loader.R 8 | ^example 9 | ^joss 10 | ^ropensci 11 | -------------------------------------------------------------------------------- /inst/example/projects/table_2.csv: -------------------------------------------------------------------------------- 1 | "","Df","Sum Sq","Mean Sq","F value","Pr(>F)" 2 | "Sepal.Width",1,22.5958005733971,22.5958005733971,2.07442689843801,0.151898260711447 3 | "Residuals",148,1612.09753275994,10.8925508970266,NA,NA 4 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | patch: 10 | default: 11 | target: auto 12 | threshold: 1% 13 | -------------------------------------------------------------------------------- /man/prov_json.Rd: -------------------------------------------------------------------------------- 1 | \docType{data} 2 | \name{prov_json} 3 | \alias{prov_json} 4 | \title{Provenance data from micro.R} 5 | \description{ 6 | Data provenance for the micro.R script in W3C Standard PROV-JSON format. 7 | } 8 | \keyword{datasets} 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: r 2 | r: 3 | - oldrel 4 | - release 5 | - devel 6 | 7 | sudo: false 8 | cache: packages 9 | 10 | warnings_are_errors: false 11 | 12 | r_packages: 13 | - devtools 14 | - testthat 15 | 16 | # bioc_packages: 17 | # - graph 18 | 19 | r_github_packages: 20 | - ProvTools/provR 21 | # - duncantl/CodeDepends 22 | 23 | after_success: 24 | - Rscript -e 'covr::codecov()' 25 | -------------------------------------------------------------------------------- /man/codeGraph.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/codeGraph.R 3 | \name{codeGraph} 4 | \alias{codeGraph} 5 | \title{codeGraph --- A network diagram of computational dependencies.} 6 | \usage{ 7 | codeGraph(g) 8 | } 9 | \arguments{ 10 | \item{g}{Matrix representation of the graph.} 11 | } 12 | \value{ 13 | A network plot. 14 | } 15 | \description{ 16 | Plot the dependencies among functions and objects for a given script. 17 | } 18 | \author{ 19 | Matthew K. Lau 20 | } 21 | -------------------------------------------------------------------------------- /man/get.libs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get.libs.R 3 | \name{get.libs} 4 | \alias{get.libs} 5 | \title{get.libs --- Determine the libraries needed for a given script.} 6 | \usage{ 7 | get.libs(src) 8 | } 9 | \arguments{ 10 | \item{src}{Character vector containing the source script.} 11 | } 12 | \value{ 13 | The libraries used for each step of the script. 14 | } 15 | \description{ 16 | Uses code dependency information to produce a set of necessary libraries. 17 | } 18 | \author{ 19 | Matthew K. Lau 20 | } 21 | -------------------------------------------------------------------------------- /example/simple_script.R: -------------------------------------------------------------------------------- 1 | ## Make a data frame 2 | mat <- matrix(rnorm(400), nrow = 100) 3 | dat <- as.data.frame(mat) 4 | dat[, "V2"] <- dat[, "V2"] + runif(nrow(dat)) 5 | dat[, "V5"] <- gl(10, 10) 6 | ## Conduct some analyses 7 | fit12 <- lm(V1 ~ V2, data = dat) 8 | fit13 <- lm(V1 ~ V3, data = dat) 9 | fit14 <- lm(V1 ~ V4, data = dat) 10 | fit15.aov <- aov(V1 ~ V2 + V5, data = dat) 11 | ## Summarize analyses 12 | summary(fit15.aov) 13 | tab.12 <- summary(fit12) 14 | tab.13 <- summary(fit13) 15 | tab.14 <- summary(fit14) 16 | tab.15 <- append(fit15.aov, tab.14) 17 | ## Conduct an off-hand calculation 18 | dat <- 25 + 2 19 | dat[2] <- 10 20 | out <- dat * 2 21 | -------------------------------------------------------------------------------- /exec/simple_script.R: -------------------------------------------------------------------------------- 1 | ## Make a data frame 2 | mat <- matrix(rnorm(400), nrow = 100) 3 | dat <- as.data.frame(mat) 4 | dat[, "V2"] <- dat[, "V2"] + runif(nrow(dat)) 5 | dat[, "V5"] <- gl(10, 10) 6 | ## Conduct some analyses 7 | fit12 <- lm(V1 ~ V2, data = dat) 8 | fit13 <- lm(V1 ~ V3, data = dat) 9 | fit14 <- lm(V1 ~ V4, data = dat) 10 | fit15.aov <- aov(V1 ~ V2 + V5, data = dat) 11 | ## Summarize analyses 12 | summary(fit15.aov) 13 | tab.12 <- summary(fit12) 14 | tab.13 <- summary(fit13) 15 | tab.14 <- summary(fit14) 16 | tab.15 <- append(fit15.aov, tab.14) 17 | ## Conduct an off-hand calculation 18 | dat <- 25 + 2 19 | dat[2] <- 10 20 | out <- dat * 2 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # History files 2 | .Rhistory 3 | .Rapp.history 4 | 5 | # Session Data files 6 | .RData 7 | 8 | # Example code in package build process 9 | *-Ex.R 10 | 11 | # Output files from R CMD build 12 | /*.tar.gz 13 | 14 | # Output files from R CMD check 15 | /*.Rcheck/ 16 | 17 | # RStudio files 18 | .Rproj.user/ 19 | 20 | # produced vignettes 21 | vignettes/*.html 22 | vignettes/*.pdf 23 | 24 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 25 | .httr-oauth 26 | 27 | # knitr and R markdown default cache directories 28 | /*_cache/ 29 | /cache/ 30 | 31 | # Temporary files created by R markdown 32 | *.utf8.md 33 | *.knit.md 34 | 35 | -------------------------------------------------------------------------------- /inst/example/simple_script.R: -------------------------------------------------------------------------------- 1 | ## Make a data frame 2 | mat <- matrix(rnorm(400), nrow = 100) 3 | dat <- as.data.frame(mat) 4 | dat[, "V2"] <- dat[, "V2"] + runif(nrow(dat)) 5 | dat[, "V5"] <- gl(10, 10) 6 | ## Conduct some analyses 7 | fit12 <- lm(V1 ~ V2, data = dat) 8 | fit13 <- lm(V1 ~ V3, data = dat) 9 | fit14 <- lm(V1 ~ V4, data = dat) 10 | fit15.aov <- aov(V1 ~ V2 + V5, data = dat) 11 | ## Summarize analyses 12 | summary(fit15.aov) 13 | tab.12 <- summary(fit12) 14 | tab.13 <- summary(fit13) 15 | tab.14 <- summary(fit14) 16 | tab.15 <- append(fit15.aov, tab.14) 17 | ## Conduct an off-hand calculation 18 | dat <- 25 + 2 19 | dat[2] <- 10 20 | out <- dat * 2 21 | -------------------------------------------------------------------------------- /tests/testthat/simple_script.R: -------------------------------------------------------------------------------- 1 | ## Make a data frame 2 | mat <- matrix(rnorm(400), nrow = 100) 3 | dat <- as.data.frame(mat) 4 | dat[, "V2"] <- dat[, "V2"] + runif(nrow(dat)) 5 | dat[, "V5"] <- gl(10, 10) 6 | ## Conduct some analyses 7 | fit12 <- lm(V1 ~ V2, data = dat) 8 | fit13 <- lm(V1 ~ V3, data = dat) 9 | fit14 <- lm(V1 ~ V4, data = dat) 10 | fit15.aov <- aov(V1 ~ V2 + V5, data = dat) 11 | ## Summarize analyses 12 | summary(fit15.aov) 13 | tab.12 <- summary(fit12) 14 | tab.13 <- summary(fit13) 15 | tab.14 <- summary(fit14) 16 | tab.15 <- append(fit15.aov, tab.14) 17 | ## Conduct an off-hand calculation 18 | dat <- 25 + 2 19 | dat[2] <- 10 20 | out <- dat * 2 21 | -------------------------------------------------------------------------------- /vignettes/example/simple_script.R: -------------------------------------------------------------------------------- 1 | ## Make a data frame 2 | mat <- matrix(rnorm(400), nrow = 100) 3 | dat <- as.data.frame(mat) 4 | dat[, "V2"] <- dat[, "V2"] + runif(nrow(dat)) 5 | dat[, "V5"] <- gl(10, 10) 6 | ## Conduct some analyses 7 | fit12 <- lm(V1 ~ V2, data = dat) 8 | fit13 <- lm(V1 ~ V3, data = dat) 9 | fit14 <- lm(V1 ~ V4, data = dat) 10 | fit15.aov <- aov(V1 ~ V2 + V5, data = dat) 11 | ## Summarize analyses 12 | summary(fit15.aov) 13 | tab.12 <- summary(fit12) 14 | tab.13 <- summary(fit13) 15 | tab.14 <- summary(fit14) 16 | tab.15 <- append(fit15.aov, tab.14) 17 | ## Conduct an off-hand calculation 18 | dat <- 25 + 2 19 | dat[2] <- 10 20 | out <- dat * 2 21 | -------------------------------------------------------------------------------- /inst/example/projects/lm_table_1.txt: -------------------------------------------------------------------------------- 1 | 2 | Call: 3 | lm(formula = Sepal.Length ~ Sepal.Width, data = data.16) 4 | 5 | Residuals: 6 | Min 1Q Median 3Q Max 7 | -6.2246 -2.5332 -0.4479 2.2318 8.8902 8 | 9 | Coefficients: 10 | Estimate Std. Error t value Pr(>|t|) 11 | (Intercept) 26.1049 1.9156 13.63 <2e-16 *** 12 | Sepal.Width -0.2234 0.1551 -1.44 0.152 13 | --- 14 | Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 15 | 16 | Residual standard error: 3.3 on 148 degrees of freedom 17 | Multiple R-squared: 0.01382, Adjusted R-squared: 0.007159 18 | F-statistic: 2.074 on 1 and 148 DF, p-value: 0.1519 19 | 20 | -------------------------------------------------------------------------------- /man/parse.info.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parse.info.R 3 | \name{parse.info} 4 | \alias{parse.info} 5 | \title{.parse.info --- Parse node information from PROV-JSON. 6 | OUTPUT = A matrix of node information.} 7 | \usage{ 8 | parse.info(prov) 9 | } 10 | \arguments{ 11 | \item{prov}{PROV-JSON formatted provenance.} 12 | } 13 | \value{ 14 | A symmetric matrix of provenance entity relationships. 15 | } 16 | \description{ 17 | This is an internal function for parsing PROV-JSON formatted 18 | provenance. 19 | } 20 | \examples{ 21 | data(prov_json) 22 | prov <- jsonlite::fromJSON(prov_json) 23 | parse.info(prov) 24 | } 25 | \author{ 26 | Matthew K. Lau 27 | } 28 | -------------------------------------------------------------------------------- /tests/testthat/lib_test.R: -------------------------------------------------------------------------------- 1 | ## Trivial library calls 2 | library(stats) 3 | require(base) 4 | ## Make a data frame 5 | mat <- matrix(rnorm(400), nrow = 100) 6 | dat <- as.data.frame(mat) 7 | dat[, "V2"] <- dat[, "V2"] + runif(nrow(dat)) 8 | dat[, "V5"] <- gl(10, 10) 9 | ## Conduct some analyses 10 | fit12 <- lm(V1 ~ V2, data = dat) 11 | fit13 <- lm(V1 ~ V3, data = dat) 12 | fit14 <- lm(V1 ~ V4, data = dat) 13 | fit15.aov <- aov(V1 ~ V2 + V5, data = dat) 14 | ## Summarize analyses 15 | summary(fit15.aov) 16 | tab.12 <- summary(fit12) 17 | tab.13 <- summary(fit13) 18 | tab.14 <- summary(fit14) 19 | tab.15 <- append(fit15.aov, tab.14) 20 | ## Conduct an off-hand calculation 21 | dat <- 25 + 2 22 | dat[2] <- 10 23 | out <- dat * 2 24 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(clean) 4 | export(codeGraph) 5 | export(get.libs) 6 | export(get.spine) 7 | export(p.spine) 8 | export(parse.graph) 9 | export(parse.info) 10 | export(read.prov) 11 | export(var.lineage) 12 | export(write.code) 13 | importFrom(CodeDepends,getDetailedTimelines) 14 | importFrom(CodeDepends,getInputs) 15 | importFrom(CodeDepends,readScript) 16 | importFrom(Rgraphviz,plot) 17 | importFrom(formatR,tidy_source) 18 | importFrom(igraph,dfs) 19 | importFrom(igraph,graph_from_adjacency_matrix) 20 | importFrom(igraph,igraph.to.graphNEL) 21 | importFrom(jsonlite,fromJSON) 22 | importFrom(methods,slot) 23 | importFrom(stats,na.omit) 24 | importFrom(utils,capture.output) 25 | importFrom(utils,sessionInfo) 26 | importFrom(utils,tail) 27 | -------------------------------------------------------------------------------- /man/read.prov.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/read.prov.R 3 | \name{read.prov} 4 | \alias{read.prov} 5 | \title{read.prov --- Read and parse provenance from a JSON file. 6 | OUTPUT = Returns a dataframe containing the provenance.} 7 | \usage{ 8 | read.prov(file) 9 | } 10 | \arguments{ 11 | \item{file}{JSON formatted object or path to PROV-JSON formatted file.} 12 | } 13 | \value{ 14 | A list containing the provenance. 15 | } 16 | \description{ 17 | This is an internal function for reading PROV-JSON formatted 18 | provenance. 19 | } 20 | \examples{ 21 | data(prov_json) 22 | prov <- read.prov(prov_json) 23 | prov$graph 24 | prov$info$activity 25 | prov$info$environment 26 | prov$info$entity 27 | } 28 | \author{ 29 | Matthew K. Lau 30 | } 31 | -------------------------------------------------------------------------------- /man/parse.graph.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parse.graph.R 3 | \name{parse.graph} 4 | \alias{parse.graph} 5 | \title{.parse.graph --- Parses the PROV-JSON formatted output 6 | OUTPUT = A symmetric matrix of provenance entity relationships.} 7 | \usage{ 8 | parse.graph(prov, rm.env = TRUE) 9 | } 10 | \arguments{ 11 | \item{prov}{PROV-JSON formatted provenance.} 12 | 13 | \item{rm.env}{LOGICAL: should the environment entity be removed?} 14 | } 15 | \value{ 16 | A symmetric matrix of provenance entity relationships. 17 | } 18 | \description{ 19 | This is an internal function for parsing PROV-JSON formatted 20 | provenance. 21 | } 22 | \examples{ 23 | data(prov_json) 24 | prov <- jsonlite::fromJSON(prov_json) 25 | parse.graph(prov) 26 | } 27 | \author{ 28 | Matthew K. Lau 29 | } 30 | -------------------------------------------------------------------------------- /man/write.code.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/write.code.R 3 | \name{write.code} 4 | \alias{write.code} 5 | \title{write.code --- Write code to disk. 6 | OUTPUT = Writes out code from an object to a specified file.} 7 | \usage{ 8 | write.code(x, file = NULL) 9 | } 10 | \arguments{ 11 | \item{x}{Script object to write.} 12 | 13 | \item{file}{Path to where you want to write. Default writes to clipboard.} 14 | } 15 | \value{ 16 | The script is written to disk, line by line. 17 | } 18 | \description{ 19 | This is a simple function for writing code to disk. 20 | } 21 | \examples{ 22 | data(prov_json) 23 | options(prov.json = prov_json) 24 | some.code <- c("x <- 1", "y <- x + 1") 25 | write.code(some.code) # copies to clipboard by default 26 | } 27 | \author{ 28 | Matthew K. Lau 29 | } 30 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Test environments 2 | * local OS X install, R 3.4.3 3 | * ubuntu 14.14 (on travis-ci), R 3.4.4 4 | * win-builder (devel and release) 5 | 6 | ## R CMD check results 7 | There were no ERRORs or WARNINGs. 8 | 9 | There were 1 NOTE: 10 | 11 | * checking CRAN incoming feasibility ... NOTE 12 | Maintainer: ‘Matthew K. Lau ’ 13 | 14 | New submission 15 | 16 | ## Downstream dependencies 17 | There are currently no downstream dependencies. 18 | 19 | ## Resubmission 20 | 21 | Removed dontrun wrappers from all function examples and used 22 | "Rclean:::" for non-exported functions. 23 | 24 | Also, fixed examples so that arguments which previously referred to x 25 | (i.e. not a character) now refer to "x". 26 | 27 | Added grant funding acknowledgment to Description along with URL and 28 | BugReports. 29 | -------------------------------------------------------------------------------- /man/get.spine.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get.spine.R 3 | \name{get.spine} 4 | \alias{get.spine} 5 | \title{.get.spine --- Find the minimal path through the provenance necessary to 6 | produce a result.} 7 | \usage{ 8 | get.spine(node.id, g) 9 | } 10 | \arguments{ 11 | \item{node.id}{Name of the node.} 12 | 13 | \item{g}{Provenance graph adjacency matrix.} 14 | } 15 | \value{ 16 | A set of node names tracing the complete parentage of a result. 17 | } 18 | \description{ 19 | OUTPUT = A vector with the set of nodes of the minimal path. 20 | } 21 | \details{ 22 | This is an internal function for parsing PROV-JSON formatted 23 | provenance. 24 | } 25 | \examples{ 26 | data(prov_json) 27 | prov <- read.prov(prov_json) 28 | get.spine("d1", prov$graph) 29 | } 30 | \author{ 31 | Matthew K. Lau 32 | } 33 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Type: Package 2 | Package: Rclean 3 | Title: A Tool for Writing Cleaner, More Transparent Code 4 | Version: 1.1.0 5 | Authors@R: person("Matthew", "Lau", email = "matthewklau@fas.harvard.edu", role = c("aut", "cre")) 6 | Description: To create clearer, more concise code provides this 7 | toolbox helps coders to isolate the essential parts of a 8 | script that produces a chosen result, such as an object, 9 | tables and figures written to disk and even warnings and 10 | errors. 11 | URL: https://github.com/ProvTools/Rclean 12 | BugReports: https://github.com/ProvTools/Rclean/issues 13 | License: GPL-3 | file LICENSE 14 | Depends: 15 | R (>= 3.5.0) 16 | Imports: igraph, jsonlite, formatR, CodeDepends, methods, Rgraphviz 17 | biocViews: Rgraphviz, graph 18 | Suggests: roxygen2, testthat, covr, knitr 19 | Remotes: MKLau/CodeDepends 20 | Language: en-US 21 | Encoding: UTF-8 22 | RoxygenNote: 6.1.1 23 | VignetteBuilder: knitr 24 | -------------------------------------------------------------------------------- /man/var.lineage.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/var.lineage.R 3 | \name{var.lineage} 4 | \alias{var.lineage} 5 | \title{var.lineage --- Determine the lineage of objects contained in an R script.} 6 | \usage{ 7 | var.lineage(x, var.id = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{Character vector of lines of code from an R script.} 11 | 12 | \item{var.id}{Variable identifier.} 13 | } 14 | \value{ 15 | A list containing a graph (g) describing the lineage of 16 | objects with steps (i.e. complexes of function and operation 17 | calls) listed as numbers that "use" or "create" data objects 18 | and a variable data frame (vdf) containing details of the 19 | variables (var) and, possibly, unique identifiers (uid) that 20 | were used or created by each step. 21 | } 22 | \description{ 23 | Determine the series of steps that leads to the production of objects contained in a script. 24 | } 25 | \author{ 26 | Matthew K. Lau 27 | } 28 | -------------------------------------------------------------------------------- /man/p.spine.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/p.spine.R 3 | \name{p.spine} 4 | \alias{p.spine} 5 | \title{p.spine --- Parentage spine for a given object.} 6 | \usage{ 7 | p.spine(g = "graph", node.id, direction = "in", sep = "_") 8 | } 9 | \arguments{ 10 | \item{g}{A graph in matrix format that presents the use and 11 | creation of variables by steps (i.e. complexes of function and 12 | operation calls).} 13 | 14 | \item{node.id}{The name of the node of interest.} 15 | 16 | \item{direction}{Determines the direction of searching on the graph, 17 | either "in" or "out".} 18 | 19 | \item{sep}{Character string used as a separator in the unique IDs of 20 | object nodes.} 21 | } 22 | \value{ 23 | A character vector of steps and objects found along the path 24 | for the object identified by the node ID. 25 | } 26 | \description{ 27 | Isolates the line of parentage for an object. This can be either 28 | all steps leading to an object or all steps leading out from an 29 | object. 30 | } 31 | \author{ 32 | Matthew K. Lau 33 | } 34 | -------------------------------------------------------------------------------- /man/clean.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/clean.R 3 | \name{clean} 4 | \alias{clean} 5 | \title{clean --- Clean code.} 6 | \usage{ 7 | clean(file, var, libs = TRUE, reformat = TRUE, plot = FALSE, 8 | rp = FALSE) 9 | } 10 | \arguments{ 11 | \item{file}{File path to a script.} 12 | 13 | \item{var}{The name of a variable of interest.} 14 | 15 | \item{libs}{LOGICAL: should library dependencies be detected and 16 | included?} 17 | 18 | \item{reformat}{LOGICAL: should the minimized code be re-formatted 19 | following common syntax?} 20 | 21 | \item{plot}{LOGICAL: should a network diagram of the cleaned script 22 | be produced?} 23 | 24 | \item{rp}{LOGICAL: should retrospective provenance be used? This 25 | should be made available in JSON format as an object within 26 | options (i.e. options(prov.json = ).} 28 | } 29 | \value{ 30 | A character vector containing a minimized script based on 31 | the given input variable. 32 | } 33 | \description{ 34 | Reduce the size and complexity of a analytical script through 35 | algorithmic detection of the essential code needed to produce a set 36 | of results. 37 | } 38 | \author{ 39 | Matthew K. Lau 40 | } 41 | -------------------------------------------------------------------------------- /R/codeGraph.R: -------------------------------------------------------------------------------- 1 | # This file is part of Rclean 2 | # 3 | # Rclean is free software; you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License 5 | # as published by the Free Software Foundation; either version 2 6 | # of the License, or (at your option) any later version. 7 | # 8 | # Rclean is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Rclean; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | # 17 | # Contact: Matthew Lau 18 | 19 | #'codeGraph --- A network diagram of computational dependencies. 20 | #' 21 | #' Plot the dependencies among functions and objects for a given script. 22 | #' 23 | #'@param g Matrix representation of the graph. 24 | #'@return A network plot. 25 | #'@importFrom igraph graph_from_adjacency_matrix 26 | #'@importFrom igraph igraph.to.graphNEL 27 | #'@importFrom Rgraphviz plot 28 | #'@export codeGraph 29 | #'@author Matthew K. Lau 30 | 31 | 32 | codeGraph <- function(g){ 33 | ig <- graph_from_adjacency_matrix(g) 34 | gNEL <- igraph.to.graphNEL(ig) 35 | Rgraphviz::plot(gNEL) 36 | } 37 | -------------------------------------------------------------------------------- /R/read.prov.R: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2017 Harvard University, Mount Holyoke College 2 | # 3 | # This file is part of Rclean 4 | # 5 | # Rclean is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License 7 | # as published by the Free Software Foundation; either version 2 8 | # of the License, or (at your option) any later version. 9 | # 10 | # Rclean is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with Rclean; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | # 19 | # Contact: Matthew Lau 20 | 21 | #' read.prov --- Read and parse provenance from a JSON file. 22 | #' OUTPUT = Returns a dataframe containing the provenance. 23 | #' 24 | #' This is an internal function for reading PROV-JSON formatted 25 | #' provenance. 26 | #' 27 | #' @param file JSON formatted object or path to PROV-JSON formatted file. 28 | #' @return A list containing the provenance. 29 | #' @author Matthew K. Lau 30 | #' @importFrom jsonlite fromJSON 31 | #' @export read.prov 32 | #' @examples 33 | #' data(prov_json) 34 | #' prov <- read.prov(prov_json) 35 | #' prov$graph 36 | #' prov$info$activity 37 | #' prov$info$environment 38 | #' prov$info$entity 39 | 40 | read.prov <- function(file){ 41 | prov <- fromJSON(file) 42 | g <- parse.graph(prov) 43 | info <- parse.info(prov) 44 | list(graph = g, info = info) 45 | } 46 | 47 | -------------------------------------------------------------------------------- /R/get.spine.R: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2017 Harvard University, Mount Holyoke College 2 | # 3 | # This file is part of Rclean 4 | # 5 | # Rclean is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License 7 | # as published by the Free Software Foundation; either version 2 8 | # of the License, or (at your option) any later version. 9 | # 10 | # Rclean is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with Rclean; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | # 19 | # Contact: Matthew Lau 20 | 21 | #' .get.spine --- Find the minimal path through the provenance necessary to 22 | #' produce a result. 23 | #' 24 | #' OUTPUT = A vector with the set of nodes of the minimal path. 25 | #' 26 | #' This is an internal function for parsing PROV-JSON formatted 27 | #' provenance. 28 | #' 29 | #' @param node.id Name of the node. 30 | #' @param g Provenance graph adjacency matrix. 31 | #' @return A set of node names tracing the complete parentage of a result. 32 | #' @author Matthew K. Lau 33 | #' @importFrom igraph dfs 34 | #' @importFrom igraph graph_from_adjacency_matrix 35 | #' @importFrom stats na.omit 36 | #' @export 37 | #' @examples 38 | #' data(prov_json) 39 | #' prov <- read.prov(prov_json) 40 | #' get.spine("d1", prov$graph) 41 | 42 | get.spine <- function(node.id, g){ 43 | ig <- graph_from_adjacency_matrix(g) 44 | as.character(na.omit(names(dfs(ig, node.id, "out" , unreachable = FALSE)$order))) 45 | } 46 | -------------------------------------------------------------------------------- /R/var.id.R: -------------------------------------------------------------------------------- 1 | # This file is part of Rclean 2 | # 3 | # Rclean is free software; you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License 5 | # as published by the Free Software Foundation; either version 2 6 | # of the License, or (at your option) any later version. 7 | # 8 | # Rclean is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Rclean; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | # 17 | # Contact: Matthew Lau 18 | 19 | #'var.id --- Generate unique identifiers for variables. 20 | #' 21 | #' Uses the order in which variables are created to assign unique 22 | #' identifiers. 23 | #' 24 | #'@param x A data frame containing "step", "used" by, "defined" by and 25 | #' "var" (i.e. variable) information. 26 | #'@param sep Text separator for the identification tags. 27 | #'@return A vector of unique identifiers based on the order of 28 | #' creation in the script. 29 | #'@author Matthew K. Lau 30 | #'@noRd 31 | 32 | var.id <- function(x, sep = "_"){ 33 | uid <- paste(x[, "var"], cumsum(x[, "defined"]), sep = sep) 34 | uid.l <- list() 35 | # create uids 36 | for (i in 1:sum(x[, "defined"])){ 37 | uid.l[[i]] <- x 38 | } 39 | for (i in 1:length(uid.l)){ 40 | y <- uid.l[[i]] 41 | y[cumsum(y[, "defined"]) != i, "used"] = FALSE 42 | y[cumsum(y[, "defined"]) != i, "defined"] = FALSE 43 | y[, "var"] <- paste(y[, "var"], i, sep = sep) 44 | uid.l[[i]] <- y 45 | } 46 | return(do.call(rbind, uid.l)) 47 | } 48 | 49 | -------------------------------------------------------------------------------- /R/parse.info.R: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2017 Harvard University, Mount Holyoke College 2 | # 3 | # This file is part of Rclean 4 | # 5 | # Rclean is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License 7 | # as published by the Free Software Foundation; either version 2 8 | # of the License, or (at your option) any later version. 9 | # 10 | # Rclean is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with Rclean; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | # 19 | # Contact: Matthew Lau 20 | 21 | 22 | #' .parse.info --- Parse node information from PROV-JSON. 23 | #' OUTPUT = A matrix of node information. 24 | #' 25 | #' This is an internal function for parsing PROV-JSON formatted 26 | #' provenance. 27 | #' 28 | #' @param prov PROV-JSON formatted provenance. 29 | #' @return A symmetric matrix of provenance entity relationships. 30 | #' @author Matthew K. Lau 31 | #' @export 32 | #' @examples 33 | #' data(prov_json) 34 | #' prov <- jsonlite::fromJSON(prov_json) 35 | #' parse.info(prov) 36 | 37 | parse.info <- function(prov){ 38 | if (grepl("rdatatracker", prov[[1]][[2]]) | grepl("provR", prov[[1]][[2]])){ 39 | activity <- prov['activity'][[1]][names(prov['activity'][[1]]) != "environment"] 40 | environment <- prov['activity'][[1]][names(prov['activity'][[1]]) == "environment"] 41 | entity <- prov['entity'][[1]] 42 | list(activity = do.call(rbind,activity), 43 | environment = environment, 44 | entity = do.call(rbind,entity)) 45 | }else{ 46 | warning("Unknown provenance: ",prov[[1]][[2]]) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/testthat/test-deps.R: -------------------------------------------------------------------------------- 1 | ## get.libs 2 | test_that("Check get.libs", { 3 | load("libs.test.rda") 4 | libs <- clean("./lib_test.R", "out") 5 | expect_true(all(libs == libs.test)) 6 | }) 7 | 8 | ## read.prov 9 | test_that("Check read.prov", { 10 | load("prov.test.rda") 11 | prov <- read.prov("micro_R.json") 12 | expect_true(all(unlist(prov) == unlist(prov.test))) 13 | }) 14 | 15 | 16 | ## parse.graph 17 | test_that("Check parse.graph", { 18 | load("prov.g.test.rda") 19 | prov.json <- fromJSON("micro_R.json") 20 | prov.g <- parse.graph(prov.json) 21 | expect_true(all(prov.g == prov.g.test)) 22 | }) 23 | 24 | ## var.lineage 25 | test_that("Check variable lineage", { 26 | load("vl.test.rda") 27 | src <- readScript("simple_script.R") 28 | vl <- var.lineage(src) 29 | expect_true(all(unlist(vl) == unlist(vl.test))) 30 | }) 31 | 32 | 33 | ## p.spine 34 | test_that("Check parentage sub-graph", { 35 | load("sp.test.rda") 36 | src <- readScript("simple_script.R") 37 | vl <- var.lineage(src) 38 | sp <- p.spine(vl, "out") 39 | expect_true(all(sp == sp.test)) 40 | }) 41 | 42 | test_that("Check parentage sub-graph length", { 43 | load("sp.test.rda") 44 | src <- readScript("simple_script.R") 45 | vl <- var.lineage(src) 46 | sp <- p.spine(vl, "out") 47 | expect_true(length(sp) == length(sp.test)) 48 | }) 49 | 50 | 51 | ## get.spine 52 | test_that("Check get.spine", { 53 | load("s.test.rda") 54 | var <- "x" 55 | prov <- read.prov("micro_R.json") 56 | node.id <- tail(n = 1, 57 | rownames(prov$info$entity)[ 58 | prov$info$entity[,1] == var] 59 | ) 60 | s <- get.spine(node.id, prov$g) 61 | expect_true(all(s == s.test)) 62 | }) 63 | 64 | ## ## parse.info 65 | test_that("Check parse.info", { 66 | load("pi.test.rda") 67 | prov <- fromJSON("micro_R.json") 68 | pi <- parse.info(prov) 69 | expect_true(all(unlist(pi) == unlist(pi.test))) 70 | }) 71 | 72 | ## ## var.id 73 | ## test_that("Check var.id", { 74 | ## load("vid.test.rda") 75 | ## vid <- 76 | ## expect_true(all( == .test)) 77 | ## }) 78 | -------------------------------------------------------------------------------- /CONTRIBUTE.md: -------------------------------------------------------------------------------- 1 | Want to contribute to Rclean? 2 | ============================= 3 | 4 | Great, thank you! 5 | 6 | We foster open, respectful software development following the code of 7 | conduct put forward by the R Community. Please take a moment to review 8 | and adhere to these guidelines when contributing: 9 | 10 | [R Community Code of Conduct](https://wiki.r-consortium.org/view/R_Consortium_and_the_R_Community_Code_of_Conduct) 11 | 12 | # Issues 13 | 14 | Just using the package and giving feedback is contributing. If 15 | the package is not working as described, congratulations you've 16 | discovered a bug! If you think this is the case, please submit an 17 | issue to the github 18 | [issue](https://github.com/ProvTools/Rclean/issues) system. 19 | 20 | Include a reproducible example in the issue or a link to a 21 | [gist](https://gist.github.com/), with the following: 22 | 23 | 1. Succinct title and description of expected results 24 | 2. Code with library dependencies and representative data for input 25 | 3. Observed results description 26 | 27 | Please check that the example runs in a fresh R session before 28 | submitting. 29 | 30 | # Enhancements 31 | 32 | If you haven't run into a bug, but would like the package to do 33 | something that it currently doesn't, you're welcome to: 34 | 35 | 1. *Fork the repository and develop your own additions.* Take a look 36 | at how our code is structured (including the comments and help 37 | documentation). Also, develop appropriate tests to check that your 38 | code is correctly integrated and runs (see the [[tests]] directory). 39 | 2. *Submit an enhancement to the issue system.* We welcome new 40 | ideas. If you think there's a feature that would be useful for the 41 | community of users to have available in the package, but aren't 42 | able to develop it your self, please let us know. 43 | 44 | # Retrospective Provenance 45 | 46 | If you have used or are a developer who uses retrospective provenance 47 | that is not currently handled by *Rclean*, please submit an 48 | *enhancement* to the issue system. We'll be happy to help implement 49 | it. 50 | 51 | # Thanks for contributing and keeping scientific software open! 52 | -------------------------------------------------------------------------------- /R/get.libs.R: -------------------------------------------------------------------------------- 1 | # This file is part of Rclean 2 | # 3 | # Rclean is free software; you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License 5 | # as published by the Free Software Foundation; either version 2 6 | # of the License, or (at your option) any later version. 7 | # 8 | # Rclean is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Rclean; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | # 17 | # Contact: Matthew Lau 18 | 19 | 20 | #'get.libs --- Determine the libraries needed for a given script. 21 | #' 22 | #' Uses code dependency information to produce a set of necessary libraries. 23 | #' 24 | #'@param src Character vector containing the source script. 25 | #'@return The libraries used for each step of the script. 26 | #'@importFrom CodeDepends getInputs 27 | #'@importFrom methods slot 28 | #'@export get.libs 29 | #'@author Matthew K. Lau 30 | 31 | get.libs <- function(src){ 32 | cd <- getInputs(src) 33 | lib <- unlist(lapply(cd, slot, name = "libraries")) 34 | lib <- unique(lib) 35 | lib.fun <- lapply(lib, function(x) ls(pos = paste0("package:", x))) 36 | names(lib.fun) <- lib 37 | step.fun <- lapply(cd, slot, name = "functions") 38 | step.fun <- lapply(step.fun, names) 39 | step.lib <- step.fun 40 | for (i in 1:length(step.fun)){ 41 | if (length(step.fun[[i]]) > 0){ 42 | for (j in 1:length(step.fun[[i]])){ 43 | if (step.fun[[i]][[j]] %in% unlist(lib.fun)){ 44 | for (k in 1:length(lib.fun)){ 45 | if (step.fun[[i]][[j]] %in% lib.fun[[k]]){ 46 | step.lib[[i]][[j]] <- names(lib.fun)[k] 47 | }else{} 48 | } 49 | }else{ 50 | step.lib[[i]][[j]] <- NA 51 | } 52 | } 53 | }else{step.lib[[i]] <- NA} 54 | } 55 | out <- unique(unlist(step.lib)) 56 | out <- out[!(is.na(out))] 57 | return(out) 58 | } 59 | -------------------------------------------------------------------------------- /R/write.code.R: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2017 Harvard University, Mount Holyoke College 2 | # 3 | # This file is part of Rclean 4 | # 5 | # Rclean is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License 7 | # as published by the Free Software Foundation; either version 2 8 | # of the License, or (at your option) any later version. 9 | # 10 | # Rclean is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with Rclean; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | # 19 | # Contact: Matthew Lau 20 | 21 | 22 | #' write.code --- Write code to disk. 23 | #' OUTPUT = Writes out code from an object to a specified file. 24 | #' 25 | #' This is a simple function for writing code to disk. 26 | #' 27 | #' @param x Script object to write. 28 | #' @param file Path to where you want to write. Default writes to clipboard. 29 | #' @return The script is written to disk, line by line. 30 | #' @importFrom utils sessionInfo 31 | #' @export write.code 32 | #' @author Matthew K. Lau 33 | #' @examples 34 | #' data(prov_json) 35 | #' options(prov.json = prov_json) 36 | #' some.code <- c("x <- 1", "y <- x + 1") 37 | #' write.code(some.code) # copies to clipboard by default 38 | 39 | write.code <- function(x, file = NULL){ 40 | if (is.null(file)){ 41 | ## Copy to clipboard depending on the system 42 | sys <- c(Sys.info()[[1]], sessionInfo()[[4]]) 43 | if (grepl("Darwin", sys[1]) | grepl("macOS", sys[2])){ 44 | ## Mac 45 | fileConn <- pipe("pbcopy", "w") 46 | }else if (grepl("Linux", sys[1])){ 47 | ## Linux 48 | fileConn <- pipe("xclip -i", "w") 49 | }else{ 50 | ## Windows 51 | fileConn <- file("clipboard-128") 52 | } 53 | }else{ 54 | file.create(file) 55 | fileConn <- file(file) 56 | } 57 | writeLines(x, fileConn) 58 | close(fileConn) 59 | } 60 | -------------------------------------------------------------------------------- /R/p.spine.R: -------------------------------------------------------------------------------- 1 | # This file is part of Rclean 2 | # 3 | # Rclean is free software; you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License 5 | # as published by the Free Software Foundation; either version 2 6 | # of the License, or (at your option) any later version. 7 | # 8 | # Rclean is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Rclean; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | # 17 | # Contact: Matthew Lau 18 | 19 | #'p.spine --- Parentage spine for a given object. 20 | #' 21 | #' Isolates the line of parentage for an object. This can be either 22 | #' all steps leading to an object or all steps leading out from an 23 | #' object. 24 | #' 25 | #'@param g A graph in matrix format that presents the use and 26 | #' creation of variables by steps (i.e. complexes of function and 27 | #' operation calls). 28 | #'@param node.id The name of the node of interest. 29 | #'@param direction Determines the direction of searching on the graph, 30 | #' either "in" or "out". 31 | #'@param sep Character string used as a separator in the unique IDs of 32 | #' object nodes. 33 | #'@return A character vector of steps and objects found along the path 34 | #' for the object identified by the node ID. 35 | #'@importFrom igraph graph_from_adjacency_matrix 36 | #'@importFrom igraph dfs 37 | #'@export p.spine 38 | #'@author Matthew K. Lau 39 | 40 | p.spine <- function(g = "graph", 41 | node.id, 42 | direction = "in", 43 | sep = "_"){ 44 | if (mode(g) == "list" & any(names(g) == "g")){g <- g[["g"]]} 45 | if (all(!(grepl(sep, rownames(g))))){sep <- ""} 46 | if (missing(node.id)){ 47 | warning("Please supply a node name.") 48 | print("Possible node names:", quote = FALSE) 49 | rownames(g)[grepl(sep, rownames(g))] 50 | }else{ 51 | ig <- graph_from_adjacency_matrix(g) 52 | dfs.out <- dfs(ig, node.id, 53 | direction, 54 | unreachable = FALSE)$order 55 | as.character(na.omit(names(dfs.out))) 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /exec/messycode.R: -------------------------------------------------------------------------------- 1 | ### Messy code is a fabricated example 2 | ### intended to capture the essentials 3 | ### of a typical, lazy scripter's R code. 4 | ### It is, however, tremendously more 5 | ### organized than the vast majority of 6 | ### scripts. 7 | 8 | ### Depedencies are loaded throughout the script. 9 | ### Also, some depencies that are loaded are often 10 | ### not used anymore but are still present. 11 | library('gdata') 12 | source("sourced.R") 13 | 14 | ### User defined functions 15 | myfunc <- function(x){ 16 | cos(x) * pi 17 | } 18 | 19 | ### Read data from some random file path 20 | ### Here, a relative path is being used, but 21 | ### typically, file paths are given from root. 22 | data.16 <- read.csv("../example/data/projects/2016/july_biomass_survey.csv") 23 | 24 | ### Some datasets are loaded and no longer used. 25 | ### Like this one 26 | data.16.2 <- read.csv('../example/data/projects/data_forestplot/dataset_v2_june_from_collaborator1.csv') 27 | 28 | ### Create a bunch of intermediate objects 29 | data.v1.1to4 <- data.16[,1:4] 30 | data.v1.1to4. <- data.v1.1to4 31 | data.v1.1to4 <- data.v1.1to4 * 2 32 | data.v1.1to4.2 <- data.v1.1to4 * 2 33 | data.16[,1:4] <- data.v1.1to4.2 34 | 35 | ### Very rarely, R scripts will have control 36 | ### statements 37 | if (any(is.na(data.16.2))){ 38 | data.16.2[is.na(data.16.2)] <- 0 39 | }# specifying the else is not required 40 | 41 | 42 | ### Conduct some analyses 43 | library('vegan') 44 | d1 <- vegdist(data.16[,1:2]) 45 | d2 <- vegdist(data.16[,2:3]) 46 | mant1 <- mantel(d1,d2) 47 | mant2 <- mantel(d2,d1) 48 | mant11 <- mantel(d1,d1) 49 | fit1 <- lm(Sepal.Length~Sepal.Width,data=data.16) 50 | lm.summary.1 <- summary(fit1) 51 | anova.summary <- anova(fit1) 52 | out.summary <- as.data.frame(anova.summary) 53 | 54 | 55 | ### for loops are also uncommon 56 | for (i in 1:ncol(data.v1.1to4)){ 57 | colnames(data.v1.1to4)[i] <- paste0("var", i) 58 | } 59 | 60 | ### write some data to file 61 | write.csv(data.v1.1to4,'../example/data/projects/data_forestplot/save1.csv',row.names = F) 62 | 63 | 64 | ### write lm and anova output to file 65 | capture.output(lm.summary.1, file="../example/data/projects/lm_table_1.txt") 66 | write.csv(out.summary, file="../example/data/projects/table_2.csv") 67 | 68 | ### use the defined function 69 | val <- myfunc(exp(1)) 70 | 71 | ### write some figures to file 72 | ### Here's another random, unused package 73 | library('txtplot') 74 | 75 | png('../example/projects/fig1_biplot.png') 76 | plot(data.16[,1:2]) 77 | dev.off() 78 | 79 | png('../example/projects/fig1_biplot_t2.png') 80 | plot(data.16[,1:2]*2) 81 | dev.off() 82 | 83 | png('../example/projects/fig2_biplot.png') 84 | plot(data.16[,2:3]) 85 | dev.off() 86 | -------------------------------------------------------------------------------- /R/parse.graph.R: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2017 Harvard University, Mount Holyoke College 2 | # 3 | # This file is part of Rclean 4 | # 5 | # Rclean is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License 7 | # as published by the Free Software Foundation; either version 2 8 | # of the License, or (at your option) any later version. 9 | # 10 | # Rclean is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with Rclean; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | # 19 | # Contact: Matthew Lau 20 | 21 | 22 | #' .parse.graph --- Parses the PROV-JSON formatted output 23 | #' OUTPUT = A symmetric matrix of provenance entity relationships. 24 | #' 25 | #' This is an internal function for parsing PROV-JSON formatted 26 | #' provenance. 27 | #' 28 | #' @param prov PROV-JSON formatted provenance. 29 | #' @param rm.env LOGICAL: should the environment entity be removed? 30 | #' @return A symmetric matrix of provenance entity relationships. 31 | #' @author Matthew K. Lau 32 | #' @export 33 | #' @examples 34 | #' data(prov_json) 35 | #' prov <- jsonlite::fromJSON(prov_json) 36 | #' parse.graph(prov) 37 | 38 | parse.graph <- function(prov,rm.env = TRUE){ 39 | if (grepl("rdatatracker", prov[[1]][[2]]) | grepl("provR", prov[[1]][[2]])){ 40 | ## prefix: information about the provenance capture mechanism 41 | ## activity: information about process nodes and environment 42 | ## environment contains information about dependencies 43 | ## entity: information about data nodes 44 | ## wasInformedBy: relations among processes 45 | ## p1 is the "Start" node 46 | ## wasGeneratedBy: relations of data output from processes 47 | ## used: relations of data used input to processes 48 | nodes <- c(names(prov['activity'][[1]]),names(prov['entity'][[1]])) 49 | el <- rbind(do.call(rbind,lapply(prov["wasGeneratedBy"][[1]],unlist)), 50 | do.call(rbind,lapply(prov["used"][[1]],unlist))) 51 | g <- matrix(0,nrow = length(nodes), ncol = length(nodes)) 52 | rownames(g) <- colnames(g) <- nodes 53 | g[el] <- 1 54 | if (rm.env){ 55 | g[rownames(g) != "environment",colnames(g) != "environment"] 56 | }else{ 57 | g 58 | } 59 | }else{ 60 | warning("Unknown provenance: ",prov[[1]][[2]]) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /inst/example/projects/data_forestplot/save1.csv: -------------------------------------------------------------------------------- 1 | "var1","var2","var3","var4" 2 | 10.2,7,2.8,0.4 3 | 9.8,6,2.8,0.4 4 | 9.4,6.4,2.6,0.4 5 | 9.2,6.2,3,0.4 6 | 10,7.2,2.8,0.4 7 | 10.8,7.8,3.4,0.8 8 | 9.2,6.8,2.8,0.6 9 | 10,6.8,3,0.4 10 | 8.8,5.8,2.8,0.4 11 | 9.8,6.2,3,0.2 12 | 10.8,7.4,3,0.4 13 | 9.6,6.8,3.2,0.4 14 | 9.6,6,2.8,0.2 15 | 8.6,6,2.2,0.2 16 | 11.6,8,2.4,0.4 17 | 11.4,8.8,3,0.8 18 | 10.8,7.8,2.6,0.8 19 | 10.2,7,2.8,0.6 20 | 11.4,7.6,3.4,0.6 21 | 10.2,7.6,3,0.6 22 | 10.8,6.8,3.4,0.4 23 | 10.2,7.4,3,0.8 24 | 9.2,7.2,2,0.4 25 | 10.2,6.6,3.4,1 26 | 9.6,6.8,3.8,0.4 27 | 10,6,3.2,0.4 28 | 10,6.8,3.2,0.8 29 | 10.4,7,3,0.4 30 | 10.4,6.8,2.8,0.4 31 | 9.4,6.4,3.2,0.4 32 | 9.6,6.2,3.2,0.4 33 | 10.8,6.8,3,0.8 34 | 10.4,8.2,3,0.2 35 | 11,8.4,2.8,0.4 36 | 9.8,6.2,3,0.4 37 | 10,6.4,2.4,0.4 38 | 11,7,2.6,0.4 39 | 9.8,7.2,2.8,0.2 40 | 8.8,6,2.6,0.4 41 | 10.2,6.8,3,0.4 42 | 10,7,2.6,0.6 43 | 9,4.6,2.6,0.6 44 | 8.8,6.4,2.6,0.4 45 | 10,7,3.2,1.2 46 | 10.2,7.6,3.8,0.8 47 | 9.6,6,2.8,0.6 48 | 10.2,7.6,3.2,0.4 49 | 9.2,6.4,2.8,0.4 50 | 10.6,7.4,3,0.4 51 | 10,6.6,2.8,0.4 52 | 14,6.4,9.4,2.8 53 | 12.8,6.4,9,3 54 | 13.8,6.2,9.8,3 55 | 11,4.6,8,2.6 56 | 13,5.6,9.2,3 57 | 11.4,5.6,9,2.6 58 | 12.6,6.6,9.4,3.2 59 | 9.8,4.8,6.6,2 60 | 13.2,5.8,9.2,2.6 61 | 10.4,5.4,7.8,2.8 62 | 10,4,7,2 63 | 11.8,6,8.4,3 64 | 12,4.4,8,2 65 | 12.2,5.8,9.4,2.8 66 | 11.2,5.8,7.2,2.6 67 | 13.4,6.2,8.8,2.8 68 | 11.2,6,9,3 69 | 11.6,5.4,8.2,2 70 | 12.4,4.4,9,3 71 | 11.2,5,7.8,2.2 72 | 11.8,6.4,9.6,3.6 73 | 12.2,5.6,8,2.6 74 | 12.6,5,9.8,3 75 | 12.2,5.6,9.4,2.4 76 | 12.8,5.8,8.6,2.6 77 | 13.2,6,8.8,2.8 78 | 13.6,5.6,9.6,2.8 79 | 13.4,6,10,3.4 80 | 12,5.8,9,3 81 | 11.4,5.2,7,2 82 | 11,4.8,7.6,2.2 83 | 11,4.8,7.4,2 84 | 11.6,5.4,7.8,2.4 85 | 12,5.4,10.2,3.2 86 | 10.8,6,9,3 87 | 12,6.8,9,3.2 88 | 13.4,6.2,9.4,3 89 | 12.6,4.6,8.8,2.6 90 | 11.2,6,8.2,2.6 91 | 11,5,8,2.6 92 | 11,5.2,8.8,2.4 93 | 12.2,6,9.2,2.8 94 | 11.6,5.2,8,2.4 95 | 10,4.6,6.6,2 96 | 11.2,5.4,8.4,2.6 97 | 11.4,6,8.4,2.4 98 | 11.4,5.8,8.4,2.6 99 | 12.4,5.8,8.6,2.6 100 | 10.2,5,6,2.2 101 | 11.4,5.6,8.2,2.6 102 | 12.6,6.6,12,5 103 | 11.6,5.4,10.2,3.8 104 | 14.2,6,11.8,4.2 105 | 12.6,5.8,11.2,3.6 106 | 13,6,11.6,4.4 107 | 15.2,6,13.2,4.2 108 | 9.8,5,9,3.4 109 | 14.6,5.8,12.6,3.6 110 | 13.4,5,11.6,3.6 111 | 14.4,7.2,12.2,5 112 | 13,6.4,10.2,4 113 | 12.8,5.4,10.6,3.8 114 | 13.6,6,11,4.2 115 | 11.4,5,10,4 116 | 11.6,5.6,10.2,4.8 117 | 12.8,6.4,10.6,4.6 118 | 13,6,11,3.6 119 | 15.4,7.6,13.4,4.4 120 | 15.4,5.2,13.8,4.6 121 | 12,4.4,10,3 122 | 13.8,6.4,11.4,4.6 123 | 11.2,5.6,9.8,4 124 | 15.4,5.6,13.4,4 125 | 12.6,5.4,9.8,3.6 126 | 13.4,6.6,11.4,4.2 127 | 14.4,6.4,12,3.6 128 | 12.4,5.6,9.6,3.6 129 | 12.2,6,9.8,3.6 130 | 12.8,5.6,11.2,4.2 131 | 14.4,6,11.6,3.2 132 | 14.8,5.6,12.2,3.8 133 | 15.8,7.6,12.8,4 134 | 12.8,5.6,11.2,4.4 135 | 12.6,5.6,10.2,3 136 | 12.2,5.2,11.2,2.8 137 | 15.4,6,12.2,4.6 138 | 12.6,6.8,11.2,4.8 139 | 12.8,6.2,11,3.6 140 | 12,6,9.6,3.6 141 | 13.8,6.2,10.8,4.2 142 | 13.4,6.2,11.2,4.8 143 | 13.8,6.2,10.2,4.6 144 | 11.6,5.4,10.2,3.8 145 | 13.6,6.4,11.8,4.6 146 | 13.4,6.6,11.4,5 147 | 13.4,6,10.4,4.6 148 | 12.6,5,10,3.8 149 | 13,6,10.4,4 150 | 12.4,6.8,10.8,4.6 151 | 11.8,6,10.2,3.6 152 | -------------------------------------------------------------------------------- /R/var.lineage.R: -------------------------------------------------------------------------------- 1 | # This file is part of Rclean 2 | # 3 | # Rclean is free software; you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License 5 | # as published by the Free Software Foundation; either version 2 6 | # of the License, or (at your option) any later version. 7 | # 8 | # Rclean is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Rclean; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | # 17 | # Contact: Matthew Lau 18 | 19 | 20 | #' var.lineage --- Determine the lineage of objects contained in an R script. 21 | #' 22 | #' Determine the series of steps that leads to the production of objects contained in a script. 23 | #' 24 | #'@param x Character vector of lines of code from an R script. 25 | #'@param var.id Variable identifier. 26 | #'@return A list containing a graph (g) describing the lineage of 27 | #' objects with steps (i.e. complexes of function and operation 28 | #' calls) listed as numbers that "use" or "create" data objects 29 | #' and a variable data frame (vdf) containing details of the 30 | #' variables (var) and, possibly, unique identifiers (uid) that 31 | #' were used or created by each step. 32 | #'@importFrom CodeDepends getDetailedTimelines 33 | #'@importFrom CodeDepends getInputs 34 | #'@export var.lineage 35 | #'@author Matthew K. Lau 36 | 37 | var.lineage <- function(x, var.id = FALSE){ 38 | ## variable data frame 39 | vdf <- getDetailedTimelines(info = getInputs(x)) 40 | if (var.id){ 41 | vdf <- do.call(rbind, lapply(split(vdf, vdf[, "var"]), var.id)) 42 | } 43 | rownames(vdf) <- 1:nrow(vdf) 44 | ## lineage graph 45 | # defined by 46 | def.by <- do.call(cbind, split(as.numeric(vdf[, "defined"]), vdf[, "var"])) 47 | rownames(def.by) <- 1:nrow(def.by) 48 | # used by 49 | use.by <- do.call(cbind, split(as.numeric(vdf[, "used"]), vdf[, "var"])) 50 | rownames(use.by) <- 1:nrow(use.by) 51 | # full lineage graph 52 | # adding empty subgraphs 53 | def.by <- cbind(array(0, dim = rep(nrow(def.by) , 2)), def.by) 54 | colnames(def.by)[1:nrow(def.by)] <- 1:nrow(def.by) 55 | use.by <- cbind(t(use.by), array(0, dim = rep(ncol(use.by), 2))) 56 | colnames(use.by)[(ncol(use.by) - nrow(use.by) + 1):ncol(use.by)] <- rownames(use.by) 57 | if (var.id){ 58 | colnames(vdf)[colnames(vdf) == "var"] <- "uid" 59 | vdf <- data.frame(vdf, 60 | var = do.call(rbind, 61 | strsplit(vdf[, "uid"], 62 | split = "_"))[, 1]) 63 | } 64 | lg <- rbind(def.by, use.by) 65 | return(list(g = lg, vdf = vdf)) 66 | } 67 | -------------------------------------------------------------------------------- /ropensci/presub_inq.md: -------------------------------------------------------------------------------- 1 | Title: Rclean: A Tool for Writing Cleaner, More Transparent Code 2 | 3 | Submitting Author: Matthew K. Lau (@mklau) 4 | Repository: https://github.com/provtools/rclean 5 | 6 | --- 7 | 8 | - Paste the full DESCRIPTION file inside a code block below: 9 | 10 | ``` 11 | Type: Package 12 | Package: Rclean 13 | Title: A Tool for Writing Cleaner, More Transparent Code 14 | Version: 1.1.0 15 | Date: 2019-04-24 16 | Author: Matthew K. Lau 17 | Maintainer: Matthew K. Lau 18 | Description: To create clearer, more concise code provides this 19 | toolbox helps coders to isolate the essential parts of a script that 20 | produces a chosen result, such as an object, tables and figures 21 | written to disk and even warnings and errors. 22 | URL: https://github.com/ProvTools/Rclean 23 | BugReports: https://github.com/ProvTools/Rclean/issues 24 | License: GPL-3 | file LICENSE 25 | Imports: igraph, jsonlite, formatR, CodeDepends 26 | Suggests: roxygen2, testthat 27 | RoxygenNote: 6.0.1 28 | 29 | ``` 30 | 31 | 32 | ## Scope 33 | 34 | - Please indicate which category or categories from our [package fit policies](https://ropensci.github.io/dev_guide/policies.html#package-categories) this package falls under: (Please check an appropriate box below.: 35 | 36 | - [ ] data retrieval 37 | - [ ] data extraction 38 | - [ ] database access 39 | - [ ] data munging 40 | - [ ] data deposition 41 | - [X] reproducibility 42 | - [ ] geospatial data 43 | - [ ] text analysis 44 | 45 | 46 | - Explain how the and why the package falls under these categories (briefly, 1-2 sentences). Please note any areas you are unsure of: 47 | 48 | In writing analytical scripts, software best practices are often a 49 | lower priority than producing inferential results, leading to large, 50 | complicated code bases that often need refactoring. The "code 51 | cleaning" capabilities of the Rclean package provide a means to 52 | rigorously identify the minimal code required to produce a given 53 | result (e.g. object, table, plot, etc.), reducing the effort required 54 | to create simpler, more transparent code that is easier to reproduce. 55 | 56 | - Who is the target audience and what are scientific applications of 57 | this package? 58 | 59 | The target audience is domain scientists that have little to no formal 60 | training in software engineering. Multiple studies on scientific 61 | reproducibility have pointed to data and software availability as 62 | limiting factors. This tool will provide an easy to use tool for 63 | writing cleaner analytical code. 64 | 65 | - Are there other R packages that accomplish the same thing? If so, 66 | how does yours differ or meet [our criteria for 67 | best-in-category](https://ropensci.github.io/dev_guide/policies.html#overlap)? 68 | 69 | There are other packages that analyze the syntax and structure of 70 | code, such as lintr, formatr and cleanr. Rclean, as far as we are 71 | aware, is the only package written for R that uses a data provenance 72 | approach to construct the interdependencies of objects and functions 73 | and then uses graph analytics to rigorously determine the desired 74 | pathways to determine the minimal code-base needed to generate an 75 | result. 76 | 77 | - Any other questions or issues we should be aware of?: 78 | 79 | Not that I can think of at the moment. 80 | -------------------------------------------------------------------------------- /inst/example/projects/data_forestplot/dataset_v1.csv: -------------------------------------------------------------------------------- 1 | "Sepal.Length","Sepal.Width","Petal.Length","Petal.Width","Species" 2 | 10.2,7,2.8,0.4,NA 3 | 9.8,6,2.8,0.4,NA 4 | 9.4,6.4,2.6,0.4,NA 5 | 9.2,6.2,3,0.4,NA 6 | 10,7.2,2.8,0.4,NA 7 | 10.8,7.8,3.4,0.8,NA 8 | 9.2,6.8,2.8,0.6,NA 9 | 10,6.8,3,0.4,NA 10 | 8.8,5.8,2.8,0.4,NA 11 | 9.8,6.2,3,0.2,NA 12 | 10.8,7.4,3,0.4,NA 13 | 9.6,6.8,3.2,0.4,NA 14 | 9.6,6,2.8,0.2,NA 15 | 8.6,6,2.2,0.2,NA 16 | 11.6,8,2.4,0.4,NA 17 | 11.4,8.8,3,0.8,NA 18 | 10.8,7.8,2.6,0.8,NA 19 | 10.2,7,2.8,0.6,NA 20 | 11.4,7.6,3.4,0.6,NA 21 | 10.2,7.6,3,0.6,NA 22 | 10.8,6.8,3.4,0.4,NA 23 | 10.2,7.4,3,0.8,NA 24 | 9.2,7.2,2,0.4,NA 25 | 10.2,6.6,3.4,1,NA 26 | 9.6,6.8,3.8,0.4,NA 27 | 10,6,3.2,0.4,NA 28 | 10,6.8,3.2,0.8,NA 29 | 10.4,7,3,0.4,NA 30 | 10.4,6.8,2.8,0.4,NA 31 | 9.4,6.4,3.2,0.4,NA 32 | 9.6,6.2,3.2,0.4,NA 33 | 10.8,6.8,3,0.8,NA 34 | 10.4,8.2,3,0.2,NA 35 | 11,8.4,2.8,0.4,NA 36 | 9.8,6.2,3,0.4,NA 37 | 10,6.4,2.4,0.4,NA 38 | 11,7,2.6,0.4,NA 39 | 9.8,7.2,2.8,0.2,NA 40 | 8.8,6,2.6,0.4,NA 41 | 10.2,6.8,3,0.4,NA 42 | 10,7,2.6,0.6,NA 43 | 9,4.6,2.6,0.6,NA 44 | 8.8,6.4,2.6,0.4,NA 45 | 10,7,3.2,1.2,NA 46 | 10.2,7.6,3.8,0.8,NA 47 | 9.6,6,2.8,0.6,NA 48 | 10.2,7.6,3.2,0.4,NA 49 | 9.2,6.4,2.8,0.4,NA 50 | 10.6,7.4,3,0.4,NA 51 | 10,6.6,2.8,0.4,NA 52 | 14,6.4,9.4,2.8,NA 53 | 12.8,6.4,9,3,NA 54 | 13.8,6.2,9.8,3,NA 55 | 11,4.6,8,2.6,NA 56 | 13,5.6,9.2,3,NA 57 | 11.4,5.6,9,2.6,NA 58 | 12.6,6.6,9.4,3.2,NA 59 | 9.8,4.8,6.6,2,NA 60 | 13.2,5.8,9.2,2.6,NA 61 | 10.4,5.4,7.8,2.8,NA 62 | 10,4,7,2,NA 63 | 11.8,6,8.4,3,NA 64 | 12,4.4,8,2,NA 65 | 12.2,5.8,9.4,2.8,NA 66 | 11.2,5.8,7.2,2.6,NA 67 | 13.4,6.2,8.8,2.8,NA 68 | 11.2,6,9,3,NA 69 | 11.6,5.4,8.2,2,NA 70 | 12.4,4.4,9,3,NA 71 | 11.2,5,7.8,2.2,NA 72 | 11.8,6.4,9.6,3.6,NA 73 | 12.2,5.6,8,2.6,NA 74 | 12.6,5,9.8,3,NA 75 | 12.2,5.6,9.4,2.4,NA 76 | 12.8,5.8,8.6,2.6,NA 77 | 13.2,6,8.8,2.8,NA 78 | 13.6,5.6,9.6,2.8,NA 79 | 13.4,6,10,3.4,NA 80 | 12,5.8,9,3,NA 81 | 11.4,5.2,7,2,NA 82 | 11,4.8,7.6,2.2,NA 83 | 11,4.8,7.4,2,NA 84 | 11.6,5.4,7.8,2.4,NA 85 | 12,5.4,10.2,3.2,NA 86 | 10.8,6,9,3,NA 87 | 12,6.8,9,3.2,NA 88 | 13.4,6.2,9.4,3,NA 89 | 12.6,4.6,8.8,2.6,NA 90 | 11.2,6,8.2,2.6,NA 91 | 11,5,8,2.6,NA 92 | 11,5.2,8.8,2.4,NA 93 | 12.2,6,9.2,2.8,NA 94 | 11.6,5.2,8,2.4,NA 95 | 10,4.6,6.6,2,NA 96 | 11.2,5.4,8.4,2.6,NA 97 | 11.4,6,8.4,2.4,NA 98 | 11.4,5.8,8.4,2.6,NA 99 | 12.4,5.8,8.6,2.6,NA 100 | 10.2,5,6,2.2,NA 101 | 11.4,5.6,8.2,2.6,NA 102 | 12.6,6.6,12,5,NA 103 | 11.6,5.4,10.2,3.8,NA 104 | 14.2,6,11.8,4.2,NA 105 | 12.6,5.8,11.2,3.6,NA 106 | 13,6,11.6,4.4,NA 107 | 15.2,6,13.2,4.2,NA 108 | 9.8,5,9,3.4,NA 109 | 14.6,5.8,12.6,3.6,NA 110 | 13.4,5,11.6,3.6,NA 111 | 14.4,7.2,12.2,5,NA 112 | 13,6.4,10.2,4,NA 113 | 12.8,5.4,10.6,3.8,NA 114 | 13.6,6,11,4.2,NA 115 | 11.4,5,10,4,NA 116 | 11.6,5.6,10.2,4.8,NA 117 | 12.8,6.4,10.6,4.6,NA 118 | 13,6,11,3.6,NA 119 | 15.4,7.6,13.4,4.4,NA 120 | 15.4,5.2,13.8,4.6,NA 121 | 12,4.4,10,3,NA 122 | 13.8,6.4,11.4,4.6,NA 123 | 11.2,5.6,9.8,4,NA 124 | 15.4,5.6,13.4,4,NA 125 | 12.6,5.4,9.8,3.6,NA 126 | 13.4,6.6,11.4,4.2,NA 127 | 14.4,6.4,12,3.6,NA 128 | 12.4,5.6,9.6,3.6,NA 129 | 12.2,6,9.8,3.6,NA 130 | 12.8,5.6,11.2,4.2,NA 131 | 14.4,6,11.6,3.2,NA 132 | 14.8,5.6,12.2,3.8,NA 133 | 15.8,7.6,12.8,4,NA 134 | 12.8,5.6,11.2,4.4,NA 135 | 12.6,5.6,10.2,3,NA 136 | 12.2,5.2,11.2,2.8,NA 137 | 15.4,6,12.2,4.6,NA 138 | 12.6,6.8,11.2,4.8,NA 139 | 12.8,6.2,11,3.6,NA 140 | 12,6,9.6,3.6,NA 141 | 13.8,6.2,10.8,4.2,NA 142 | 13.4,6.2,11.2,4.8,NA 143 | 13.8,6.2,10.2,4.6,NA 144 | 11.6,5.4,10.2,3.8,NA 145 | 13.6,6.4,11.8,4.6,NA 146 | 13.4,6.6,11.4,5,NA 147 | 13.4,6,10.4,4.6,NA 148 | 12.6,5,10,3.8,NA 149 | 13,6,10.4,4,NA 150 | 12.4,6.8,10.8,4.6,NA 151 | 11.8,6,10.2,3.6,NA 152 | -------------------------------------------------------------------------------- /tests/testthat/test-main.R: -------------------------------------------------------------------------------- 1 | # Prospective Provenance (i.e. rp = FALSE) 2 | test_that("clean options prospective", { 3 | load("opt.test.rda") 4 | opt <- clean("simple_script.R") 5 | expect_true(all(opt == opt.test)) 6 | }) 7 | 8 | test_that("clean prospective data.frame", { 9 | load("clean.simple.out.test.rda") 10 | clean.simple.out <- clean("simple_script.R", "out") 11 | expect_true(all(clean.simple.out == clean.simple.out.test)) 12 | }) 13 | 14 | 15 | test_that("clean libs prospective", { 16 | load("lib.test.rda") 17 | lib <- clean("lib_test.R", "out") 18 | expect_true(all(lib[1:2] == lib.test[1:2])) 19 | }) 20 | 21 | 22 | test_that("clean prospective no re-formatting", { 23 | load("format.simple.out.test.rda") 24 | format.simple.out <- clean("simple_script.R", "out") 25 | expect_true(all(format.simple.out == format.simple.out.test)) 26 | }) 27 | 28 | 29 | # Retrospective Provenance (i.e. rp = TRUE) 30 | ## provR 31 | test_that("check provenance storage", { 32 | options(prov.json = readLines("micro_R.json")) 33 | prov <- read.prov(options()$prov.json) 34 | expect_match(mode(prov), "list") 35 | expect_equal(length(prov), 2) 36 | }) 37 | 38 | test_that("Provenance graph", { 39 | options(prov.json = readLines("micro_R.json")) 40 | prov <- read.prov(options()$prov.json) 41 | expect_match(mode(prov$graph), "numeric") 42 | expect_match(class(prov$graph), "matrix") 43 | }) 44 | 45 | test_that("Provenance info", { 46 | options(prov.json = readLines("micro_R.json")) 47 | prov <- read.prov(options()$prov.json) 48 | expect_equal(length(prov$info), 3) 49 | }) 50 | 51 | test_that("clean RP options", { 52 | load("rp.options.test.rda") 53 | options(prov.json = readLines("micro_R.json")) 54 | rp.options <- clean("micro.R", rp = TRUE) 55 | expect_true(all(rp.options == rp.options.test)) 56 | }) 57 | 58 | test_that("clean RP x", { 59 | load("rp.clean.x.test.rda") 60 | options(prov.json = readLines("micro_R.json")) 61 | rp.clean.x <- clean("micro.R", "x", rp = TRUE) 62 | expect_true(all(rp.clean.x == rp.clean.x.test)) 63 | }) 64 | 65 | test_that("clean RP y", { 66 | load("rp.clean.y.test.rda") 67 | options(prov.json = readLines("micro_R.json")) 68 | rp.clean.y <- clean("micro.R", "y", rp = TRUE) 69 | expect_true(all(rp.clean.y == rp.clean.y.test)) 70 | }) 71 | 72 | 73 | ## test_that("rmd2chunks", { 74 | ## load("rmd.file.rda") 75 | ## load("rmd.chunks.test.rda") 76 | ## rmd.chunks <- rmd2chunks(rmd.file) 77 | ## expect_true(all(rmd.chunks == rmd.chunks.test)) 78 | ## }) 79 | 80 | test_that("codeGraph", { 81 | load("codeGraph.src.rda") 82 | vl <- var.lineage(src) 83 | sp <- p.spine(vl, "out") 84 | min.g <- vl[["g"]][rownames(vl[["g"]]) %in% as.character(sp), 85 | colnames(vl[["g"]]) %in% as.character(sp)] 86 | output.cap <- capture.output(codeGraph(min.g)) 87 | expect_true(length(output.cap) == 0) 88 | }) 89 | 90 | test_that("read.prov", { 91 | load("read.prov.test") 92 | prov <- read.prov("micro_R.json") 93 | expect_true(all(unlist(prov) == unlist(prov.test))) 94 | }) 95 | 96 | 97 | test_that("write.code", { 98 | load("write.code.test.rda") 99 | write.code(clean.simple.out, file = "clean.simple.test.R") 100 | write.code.test <- readLines("clean.simple.test.R") 101 | file.remove("clean.simple.test.R") 102 | expect_true(all(clean.simple.out == write.code.test)) 103 | }) 104 | 105 | test_that("var.id", { 106 | load("var.id.test.rda") 107 | src <- readScript("micro.R") 108 | vl <- var.lineage(src) 109 | var.id.out <- Rclean:::var.id(vl$vdf) 110 | expect_true(all(var.id.out == var.id.test)) 111 | }) 112 | 113 | -------------------------------------------------------------------------------- /inst/example/projects/2016/july_biomass_survey.csv: -------------------------------------------------------------------------------- 1 | "Sepal.Length","Sepal.Width","Petal.Length","Petal.Width","Species" 2 | 5.1,3.5,1.4,0.2,"setosa" 3 | 4.9,3,1.4,0.2,"setosa" 4 | 4.7,3.2,1.3,0.2,"setosa" 5 | 4.6,3.1,1.5,0.2,"setosa" 6 | 5,3.6,1.4,0.2,"setosa" 7 | 5.4,3.9,1.7,0.4,"setosa" 8 | 4.6,3.4,1.4,0.3,"setosa" 9 | 5,3.4,1.5,0.2,"setosa" 10 | 4.4,2.9,1.4,0.2,"setosa" 11 | 4.9,3.1,1.5,0.1,"setosa" 12 | 5.4,3.7,1.5,0.2,"setosa" 13 | 4.8,3.4,1.6,0.2,"setosa" 14 | 4.8,3,1.4,0.1,"setosa" 15 | 4.3,3,1.1,0.1,"setosa" 16 | 5.8,4,1.2,0.2,"setosa" 17 | 5.7,4.4,1.5,0.4,"setosa" 18 | 5.4,3.9,1.3,0.4,"setosa" 19 | 5.1,3.5,1.4,0.3,"setosa" 20 | 5.7,3.8,1.7,0.3,"setosa" 21 | 5.1,3.8,1.5,0.3,"setosa" 22 | 5.4,3.4,1.7,0.2,"setosa" 23 | 5.1,3.7,1.5,0.4,"setosa" 24 | 4.6,3.6,1,0.2,"setosa" 25 | 5.1,3.3,1.7,0.5,"setosa" 26 | 4.8,3.4,1.9,0.2,"setosa" 27 | 5,3,1.6,0.2,"setosa" 28 | 5,3.4,1.6,0.4,"setosa" 29 | 5.2,3.5,1.5,0.2,"setosa" 30 | 5.2,3.4,1.4,0.2,"setosa" 31 | 4.7,3.2,1.6,0.2,"setosa" 32 | 4.8,3.1,1.6,0.2,"setosa" 33 | 5.4,3.4,1.5,0.4,"setosa" 34 | 5.2,4.1,1.5,0.1,"setosa" 35 | 5.5,4.2,1.4,0.2,"setosa" 36 | 4.9,3.1,1.5,0.2,"setosa" 37 | 5,3.2,1.2,0.2,"setosa" 38 | 5.5,3.5,1.3,0.2,"setosa" 39 | 4.9,3.6,1.4,0.1,"setosa" 40 | 4.4,3,1.3,0.2,"setosa" 41 | 5.1,3.4,1.5,0.2,"setosa" 42 | 5,3.5,1.3,0.3,"setosa" 43 | 4.5,2.3,1.3,0.3,"setosa" 44 | 4.4,3.2,1.3,0.2,"setosa" 45 | 5,3.5,1.6,0.6,"setosa" 46 | 5.1,3.8,1.9,0.4,"setosa" 47 | 4.8,3,1.4,0.3,"setosa" 48 | 5.1,3.8,1.6,0.2,"setosa" 49 | 4.6,3.2,1.4,0.2,"setosa" 50 | 5.3,3.7,1.5,0.2,"setosa" 51 | 5,3.3,1.4,0.2,"setosa" 52 | 7,3.2,4.7,1.4,"versicolor" 53 | 6.4,3.2,4.5,1.5,"versicolor" 54 | 6.9,3.1,4.9,1.5,"versicolor" 55 | 5.5,2.3,4,1.3,"versicolor" 56 | 6.5,2.8,4.6,1.5,"versicolor" 57 | 5.7,2.8,4.5,1.3,"versicolor" 58 | 6.3,3.3,4.7,1.6,"versicolor" 59 | 4.9,2.4,3.3,1,"versicolor" 60 | 6.6,2.9,4.6,1.3,"versicolor" 61 | 5.2,2.7,3.9,1.4,"versicolor" 62 | 5,2,3.5,1,"versicolor" 63 | 5.9,3,4.2,1.5,"versicolor" 64 | 6,2.2,4,1,"versicolor" 65 | 6.1,2.9,4.7,1.4,"versicolor" 66 | 5.6,2.9,3.6,1.3,"versicolor" 67 | 6.7,3.1,4.4,1.4,"versicolor" 68 | 5.6,3,4.5,1.5,"versicolor" 69 | 5.8,2.7,4.1,1,"versicolor" 70 | 6.2,2.2,4.5,1.5,"versicolor" 71 | 5.6,2.5,3.9,1.1,"versicolor" 72 | 5.9,3.2,4.8,1.8,"versicolor" 73 | 6.1,2.8,4,1.3,"versicolor" 74 | 6.3,2.5,4.9,1.5,"versicolor" 75 | 6.1,2.8,4.7,1.2,"versicolor" 76 | 6.4,2.9,4.3,1.3,"versicolor" 77 | 6.6,3,4.4,1.4,"versicolor" 78 | 6.8,2.8,4.8,1.4,"versicolor" 79 | 6.7,3,5,1.7,"versicolor" 80 | 6,2.9,4.5,1.5,"versicolor" 81 | 5.7,2.6,3.5,1,"versicolor" 82 | 5.5,2.4,3.8,1.1,"versicolor" 83 | 5.5,2.4,3.7,1,"versicolor" 84 | 5.8,2.7,3.9,1.2,"versicolor" 85 | 6,2.7,5.1,1.6,"versicolor" 86 | 5.4,3,4.5,1.5,"versicolor" 87 | 6,3.4,4.5,1.6,"versicolor" 88 | 6.7,3.1,4.7,1.5,"versicolor" 89 | 6.3,2.3,4.4,1.3,"versicolor" 90 | 5.6,3,4.1,1.3,"versicolor" 91 | 5.5,2.5,4,1.3,"versicolor" 92 | 5.5,2.6,4.4,1.2,"versicolor" 93 | 6.1,3,4.6,1.4,"versicolor" 94 | 5.8,2.6,4,1.2,"versicolor" 95 | 5,2.3,3.3,1,"versicolor" 96 | 5.6,2.7,4.2,1.3,"versicolor" 97 | 5.7,3,4.2,1.2,"versicolor" 98 | 5.7,2.9,4.2,1.3,"versicolor" 99 | 6.2,2.9,4.3,1.3,"versicolor" 100 | 5.1,2.5,3,1.1,"versicolor" 101 | 5.7,2.8,4.1,1.3,"versicolor" 102 | 6.3,3.3,6,2.5,"virginica" 103 | 5.8,2.7,5.1,1.9,"virginica" 104 | 7.1,3,5.9,2.1,"virginica" 105 | 6.3,2.9,5.6,1.8,"virginica" 106 | 6.5,3,5.8,2.2,"virginica" 107 | 7.6,3,6.6,2.1,"virginica" 108 | 4.9,2.5,4.5,1.7,"virginica" 109 | 7.3,2.9,6.3,1.8,"virginica" 110 | 6.7,2.5,5.8,1.8,"virginica" 111 | 7.2,3.6,6.1,2.5,"virginica" 112 | 6.5,3.2,5.1,2,"virginica" 113 | 6.4,2.7,5.3,1.9,"virginica" 114 | 6.8,3,5.5,2.1,"virginica" 115 | 5.7,2.5,5,2,"virginica" 116 | 5.8,2.8,5.1,2.4,"virginica" 117 | 6.4,3.2,5.3,2.3,"virginica" 118 | 6.5,3,5.5,1.8,"virginica" 119 | 7.7,3.8,6.7,2.2,"virginica" 120 | 7.7,2.6,6.9,2.3,"virginica" 121 | 6,2.2,5,1.5,"virginica" 122 | 6.9,3.2,5.7,2.3,"virginica" 123 | 5.6,2.8,4.9,2,"virginica" 124 | 7.7,2.8,6.7,2,"virginica" 125 | 6.3,2.7,4.9,1.8,"virginica" 126 | 6.7,3.3,5.7,2.1,"virginica" 127 | 7.2,3.2,6,1.8,"virginica" 128 | 6.2,2.8,4.8,1.8,"virginica" 129 | 6.1,3,4.9,1.8,"virginica" 130 | 6.4,2.8,5.6,2.1,"virginica" 131 | 7.2,3,5.8,1.6,"virginica" 132 | 7.4,2.8,6.1,1.9,"virginica" 133 | 7.9,3.8,6.4,2,"virginica" 134 | 6.4,2.8,5.6,2.2,"virginica" 135 | 6.3,2.8,5.1,1.5,"virginica" 136 | 6.1,2.6,5.6,1.4,"virginica" 137 | 7.7,3,6.1,2.3,"virginica" 138 | 6.3,3.4,5.6,2.4,"virginica" 139 | 6.4,3.1,5.5,1.8,"virginica" 140 | 6,3,4.8,1.8,"virginica" 141 | 6.9,3.1,5.4,2.1,"virginica" 142 | 6.7,3.1,5.6,2.4,"virginica" 143 | 6.9,3.1,5.1,2.3,"virginica" 144 | 5.8,2.7,5.1,1.9,"virginica" 145 | 6.8,3.2,5.9,2.3,"virginica" 146 | 6.7,3.3,5.7,2.5,"virginica" 147 | 6.7,3,5.2,2.3,"virginica" 148 | 6.3,2.5,5,1.9,"virginica" 149 | 6.5,3,5.2,2,"virginica" 150 | 6.2,3.4,5.4,2.3,"virginica" 151 | 5.9,3,5.1,1.8,"virginica" 152 | -------------------------------------------------------------------------------- /inst/example/projects/data_forestplot/dataset_v2_june_from_collaborator1.csv: -------------------------------------------------------------------------------- 1 | "Sepal.Length","Sepal.Width","Petal.Length","Petal.Width","Species" 2 | 5.1,3.5,1.4,0.2,"setosa" 3 | 4.9,3,1.4,0.2,"setosa" 4 | 4.7,3.2,1.3,0.2,"setosa" 5 | 4.6,3.1,1.5,0.2,"setosa" 6 | 5,500,1.4,0.2,"setosa" 7 | 5.4,3.9,1.7,0.4,"setosa" 8 | 4.6,3.4,1.4,0.3,"setosa" 9 | 5,3.4,1.5,0.2,"setosa" 10 | 4.4,2.9,1.4,0.2,"setosa" 11 | 4.9,3.1,1.5,0.1,"setosa" 12 | 5.4,3.7,1.5,0.2,"setosa" 13 | 4.8,3.4,1.6,0.2,"setosa" 14 | 4.8,3,1.4,0.1,"setosa" 15 | 4.3,3,1.1,0.1,"setosa" 16 | 5.8,4,1.2,0.2,"setosa" 17 | 5.7,4.4,1.5,0.4,"setosa" 18 | 5.4,3.9,1.3,0.4,"setosa" 19 | 5.1,3.5,1.4,0.3,"setosa" 20 | 5.7,3.8,1.7,0.3,"setosa" 21 | 5.1,3.8,1.5,0.3,"setosa" 22 | 5.4,3.4,1.7,0.2,"setosa" 23 | 5.1,3.7,1.5,0.4,"setosa" 24 | 4.6,3.6,1,0.2,"setosa" 25 | 5.1,3.3,1.7,0.5,"setosa" 26 | 4.8,3.4,1.9,0.2,"setosa" 27 | 5,3,1.6,0.2,"setosa" 28 | 5,3.4,1.6,0.4,"setosa" 29 | 5.2,3.5,1.5,0.2,"setosa" 30 | 5.2,3.4,1.4,0.2,"setosa" 31 | 4.7,3.2,1.6,0.2,"setosa" 32 | 4.8,3.1,1.6,0.2,"setosa" 33 | 5.4,3.4,1.5,0.4,"setosa" 34 | 5.2,4.1,1.5,0.1,"setosa" 35 | 5.5,4.2,1.4,0.2,"setosa" 36 | 4.9,3.1,1.5,0.2,"setosa" 37 | 5,3.2,1.2,0.2,"setosa" 38 | 5.5,3.5,1.3,0.2,"setosa" 39 | 4.9,3.6,1.4,0.1,"setosa" 40 | 4.4,3,1.3,0.2,"setosa" 41 | 5.1,3.4,1.5,0.2,"setosa" 42 | 5,3.5,1.3,0.3,"setosa" 43 | 4.5,2.3,1.3,0.3,"setosa" 44 | 4.4,3.2,1.3,0.2,"setosa" 45 | 5,3.5,1.6,0.6,"setosa" 46 | 5.1,3.8,1.9,0.4,"setosa" 47 | 4.8,3,1.4,0.3,"setosa" 48 | 5.1,3.8,1.6,0.2,"setosa" 49 | 4.6,3.2,1.4,0.2,"setosa" 50 | 5.3,3.7,1.5,0.2,"setosa" 51 | 5,3.3,1.4,0.2,"setosa" 52 | 7,3.2,4.7,1.4,"versicolor" 53 | 6.4,3.2,4.5,1.5,"versicolor" 54 | 6.9,3.1,4.9,1.5,"versicolor" 55 | 5.5,2.3,4,1.3,"versicolor" 56 | 6.5,2.8,4.6,1.5,"versicolor" 57 | 5.7,2.8,4.5,1.3,"versicolor" 58 | 6.3,3.3,4.7,1.6,"versicolor" 59 | 4.9,2.4,3.3,1,"versicolor" 60 | 6.6,2.9,4.6,1.3,"versicolor" 61 | 5.2,2.7,3.9,1.4,"versicolor" 62 | 5,2,3.5,1,"versicolor" 63 | 5.9,3,4.2,1.5,"versicolor" 64 | 6,2.2,4,1,"versicolor" 65 | 6.1,2.9,4.7,1.4,"versicolor" 66 | 5.6,2.9,3.6,1.3,"versicolor" 67 | 6.7,3.1,4.4,1.4,"versicolor" 68 | 5.6,3,4.5,1.5,"versicolor" 69 | 5.8,2.7,4.1,1,"versicolor" 70 | 6.2,2.2,4.5,1.5,"versicolor" 71 | 5.6,2.5,3.9,1.1,"versicolor" 72 | 5.9,3.2,4.8,1.8,"versicolor" 73 | 6.1,2.8,4,1.3,"versicolor" 74 | 6.3,2.5,4.9,1.5,"versicolor" 75 | 6.1,2.8,4.7,1.2,"versicolor" 76 | 6.4,2.9,4.3,1.3,"versicolor" 77 | 6.6,3,4.4,1.4,"versicolor" 78 | 6.8,2.8,4.8,1.4,"versicolor" 79 | 6.7,3,5,1.7,"versicolor" 80 | 6,2.9,4.5,1.5,"versicolor" 81 | 5.7,2.6,3.5,1,"versicolor" 82 | 5.5,2.4,3.8,1.1,"versicolor" 83 | 5.5,2.4,3.7,1,"versicolor" 84 | 5.8,2.7,3.9,1.2,"versicolor" 85 | 6,2.7,5.1,1.6,"versicolor" 86 | 5.4,3,4.5,1.5,"versicolor" 87 | 6,3.4,4.5,1.6,"versicolor" 88 | 6.7,3.1,4.7,1.5,"versicolor" 89 | 6.3,2.3,4.4,1.3,"versicolor" 90 | 5.6,3,4.1,1.3,"versicolor" 91 | 5.5,2.5,4,1.3,"versicolor" 92 | 5.5,2.6,4.4,1.2,"versicolor" 93 | 6.1,3,4.6,1.4,"versicolor" 94 | 5.8,2.6,4,1.2,"versicolor" 95 | 5,2.3,3.3,1,"versicolor" 96 | 5.6,2.7,4.2,1.3,"versicolor" 97 | 5.7,3,4.2,1.2,"versicolor" 98 | 5.7,2.9,4.2,1.3,"versicolor" 99 | 6.2,2.9,4.3,1.3,"versicolor" 100 | 5.1,2.5,3,1.1,"versicolor" 101 | 5.7,2.8,4.1,1.3,"versicolor" 102 | 6.3,3.3,6,2.5,"virginica" 103 | 5.8,2.7,5.1,1.9,"virginica" 104 | 7.1,3,5.9,2.1,"virginica" 105 | 6.3,2.9,5.6,1.8,"virginica" 106 | 6.5,3,5.8,2.2,"virginica" 107 | 7.6,3,6.6,2.1,"virginica" 108 | 4.9,2.5,4.5,1.7,"virginica" 109 | 7.3,2.9,6.3,1.8,"virginica" 110 | 6.7,2.5,5.8,1.8,"virginica" 111 | 7.2,3.6,6.1,2.5,"virginica" 112 | 6.5,3.2,5.1,2,"virginica" 113 | 6.4,2.7,5.3,1.9,"virginica" 114 | 6.8,3,5.5,2.1,"virginica" 115 | 5.7,2.5,5,2,"virginica" 116 | 5.8,2.8,5.1,2.4,"virginica" 117 | 6.4,3.2,5.3,2.3,"virginica" 118 | 6.5,3,5.5,1.8,"virginica" 119 | 7.7,3.8,6.7,2.2,"virginica" 120 | 7.7,2.6,6.9,2.3,"virginica" 121 | 6,2.2,5,1.5,"virginica" 122 | 6.9,3.2,5.7,2.3,"virginica" 123 | 5.6,2.8,4.9,2,"virginica" 124 | 7.7,2.8,6.7,2,"virginica" 125 | 6.3,2.7,4.9,1.8,"virginica" 126 | 6.7,3.3,5.7,2.1,"virginica" 127 | 7.2,3.2,6,1.8,"virginica" 128 | 6.2,2.8,4.8,1.8,"virginica" 129 | 6.1,3,4.9,1.8,"virginica" 130 | 6.4,2.8,5.6,2.1,"virginica" 131 | 7.2,3,5.8,1.6,"virginica" 132 | 7.4,2.8,6.1,1.9,"virginica" 133 | 7.9,3.8,6.4,2,"virginica" 134 | 6.4,2.8,5.6,2.2,"virginica" 135 | 6.3,2.8,5.1,1.5,"virginica" 136 | 6.1,2.6,5.6,1.4,"virginica" 137 | 7.7,3,6.1,2.3,"virginica" 138 | 6.3,3.4,5.6,2.4,"virginica" 139 | 6.4,3.1,5.5,1.8,"virginica" 140 | 6,3,4.8,1.8,"virginica" 141 | 6.9,3.1,5.4,2.1,"virginica" 142 | 6.7,3.1,5.6,2.4,"virginica" 143 | 6.9,3.1,5.1,2.3,"virginica" 144 | 5.8,2.7,5.1,1.9,"virginica" 145 | 6.8,3.2,5.9,2.3,"virginica" 146 | 6.7,3.3,5.7,2.5,"virginica" 147 | 6.7,3,5.2,2.3,"virginica" 148 | 6.3,2.5,5,1.9,"virginica" 149 | 6.5,3,5.2,2,"virginica" 150 | 6.2,3.4,5.4,2.3,"virginica" 151 | 5.9,3,5.1,1.8,"virginica" 152 | -------------------------------------------------------------------------------- /joss/paper.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Rclean: A Tool for Writing Cleaner, More Transparent Code' 3 | tags: 4 | - R 5 | - reproducibility 6 | - transparency 7 | - code cleaning 8 | - data provenance 9 | authors: 10 | - name: Matthew K. Lau 11 | orcid: 0000-0003-3758-2406 12 | affiliation: 1 13 | - name: Thomas F. J.-M. Pasquier 14 | orcid: 0000-0001-6876-1306 15 | affiliation: "2, 3" 16 | - name: Elizabeth Fong 17 | orcid: 0000-0002-7851-4912 18 | affiliation: "4" 19 | - name: Margo Seltzer 20 | orcid: 0000-0002-2165-4658 21 | affiliation: "5" 22 | affiliations: 23 | - name: Harvard Forest, Harvard University 24 | index: 1 25 | - name: Department of Computer Science, University of Bristol 26 | index: 2 27 | - name: School of Engineering and Applied Science, Harvard University 28 | index: 3 29 | - name: Department of Computer Sciences, Mount Holyoke College 30 | index: 4 31 | - name: Department of Computer Science, University of British Columbia 32 | index: 5 33 | date: 2 February 2019 34 | bibliography: paper.bib 35 | --- 36 | 37 | 38 | # Introduction 39 | 40 | The growth of open-source statistical software programming has been 41 | explosive in the last decade. In particular, the statistical 42 | programming language ``R`` has grown exponentially to become one of 43 | the top ten programming languages in use today. Recently, concerns 44 | have arisen over the reproducibility of scientific research 45 | [@Peng2011 @Baker2016 @Stodden2018] and the potential issues stemming 46 | from the complexity and fragility of analytical software 47 | [@Pasquier2017 @Chen2018]. There is now a recognition that simply 48 | making the code open is not enough, and that there is a need for 49 | improvements to documentation and transparency [@Chen2018]. From this 50 | perspective, tools that can lower the time and energy required to 51 | re-factor and streamline analytical scripts could have a significant 52 | impact on scientific reproducibility across all disciplines 53 | [@Visser2015]. Supporting this objective, we have created ``Rclean`` 54 | which automatically reduces a script to the parts that are 55 | specifically relevant to a research product, such as a blog, academic 56 | talk or research article. 57 | 58 | 59 | # Methods 60 | 61 | The ``Rclean`` package provides a simple, easy to use tool for 62 | scientists conducting analyses in the R programming language. Using 63 | graph analytic algorithms, ``Rclean`` isolates the code necessary to 64 | produce a specified result (e.g., an object stored in memory or a 65 | table or figure written to disk). This process relies on the 66 | generation of data provenance [@Carata2014], which is a formal 67 | representation of the execution of a computational process 68 | (https://www.w3.org/TR/prov-dm/), to rigorously determine the the 69 | unique computational pathway from inputs to results. However, as the 70 | intended user is a researcher conducting analyses, the process is 71 | abstracted and only the minimum information is required and presented 72 | to the user to streamline the process of creating "cleaner" code. The 73 | output generated by ``RClean`` is the minimum and sufficient code 74 | needed to generate the chosen result. 75 | 76 | 77 | Obtaining provenance graph 78 | 79 | Prospective provenance 80 | 81 | Retrospective provenance requirements 82 | 83 | Description of graph algorithm used 84 | 85 | Detecting package libraries 86 | 87 | # Example 88 | 89 | Basic script 90 | 91 | Cleaned script 92 | 93 | 94 | 95 | # Discussion 96 | 97 | Application to notebooks 98 | 99 | Automation of code-base reduction and transparency 100 | 101 | As statistical programming becomes more common across the sciences, 102 | tools that make the production of accessible code will be an important 103 | aid for improving scientific reproducibility. ``Rclean`` has been 104 | designed to take advantage of recent advances in data provenance 105 | capture techniques to create a minimalistic tool for this purpose. New 106 | users can easily install the package from the Comprehensive R Archive 107 | Network (CRAN) [@Lau2018]. The package is open-source and welcomes 108 | contributions. For example, the existing framework could be extended 109 | to support new provenance capture methods, and there is tremendous 110 | potential for the use of code cleaning in the creation of more robust 111 | capsules [@Pasquier2018]. Interested contributors can connect to the 112 | project at https://github.com/provtools/Rclean. The project is also 113 | tagged and curated at Zenodo (DOI: 10.5281/zenodo.1208640). 114 | 115 | 116 | 117 | # Acknowledgments 118 | 119 | This work was improved by discussions with ecologists at Harvard 120 | Forest. Much of the work was funded by US National Science Foundation 121 | grant SSI-1450277 for applications of End-to-End Data Provenance. 122 | 123 | # References 124 | 125 | -------------------------------------------------------------------------------- /vignettes/Rclean.rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Rclean" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteEngine{knitr::rmarkdown} 6 | %\VignetteIndexEntry{Rclean} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | 11 | 12 | 13 | 14 | ```{r setup, echo = FALSE} 15 | knitr::opts_chunk$set( 16 | collapse = TRUE, 17 | comment = "#>", 18 | fig.path = "man/figures/README-" 19 | ) 20 | original_files <- dir() 21 | ``` 22 | 23 | # Clean up your code 24 | 25 | - Have you ever written a long script in R that conducts lots of 26 | analyses and wished that someone would come along and make it all 27 | clearer to understand and use? 28 | - Well you’re not alone. 29 | - A recent survey of over 1500 scientists reported a crisis of 30 | reproducibility with "selective reporting" being the most cited 31 | contributing factor and 80% saying code availability is playing a 32 | role. 33 | - [Rclean](https://github.com/ProvTools/Rclean) was created to help 34 | scientists more *easily* write "cleaner" code by providing a simple, 35 | rigorous way to isolate the minimal code you need in order to 36 | produce a specific result (e.g. object, plot, output written to 37 | disk). 38 | - [Rclean](https://github.com/ProvTools/Rclean) is built on data 39 | provenance, a formal representation of a computation, and uses graph 40 | analysis to determine the minimal path from inputs to results. 41 | - The goal is to help facilitate code transparency, reproducibility, 42 | reusability and ultimately help scientists spend more time on 43 | research and less time on software. 44 | 45 | # Install 46 | 47 | 48 | You can install 49 | [Rclean](https://cran.r-project.org/web/packages/Rclean/) from *CRAN*: 50 | 51 | ```{r eval = FALSE} 52 | install.packages("Rclean") 53 | ``` 54 | 55 | You can install the most up to date (beta) version easily with 56 | [devtools](https://github.com/hadley/devtools): 57 | 58 | ```{r eval = FALSE} 59 | install.packages("devtools") 60 | devtools::install_github("ProvTools/Rclean", ref = "dev") 61 | ``` 62 | 63 | 64 | Once installed, per usual R practice, just load the *Rclean*: 65 | 66 | ```{r eval = TRUE} 67 | library(Rclean) 68 | ``` 69 | 70 | # Usage 71 | 72 | 73 | *Rclean* usage is simple. Have a script with code you want to clean 74 | saved to disk. Then, just run the `clean` function with the path to 75 | the script as the input. Here, we can use an example script that is 76 | included with the package: 77 | 78 | ```{r eval = TRUE} 79 | clean("example/simple_script.R") 80 | ``` 81 | 82 | This returns a list of possible results detected in the script, 83 | including execution lines (not counting lines with no code or that are 84 | commented). We can now pick the result we want to focus on for 85 | cleaning: 86 | 87 | 88 | ```{r eval = TRUE} 89 | clean("./example/simple_script.R", "tab.15") 90 | ``` 91 | 92 | This produces the minimal code detected from the script. It also 93 | detects library dependencies and inserts them into the code (`libs = 94 | TRUE`). 95 | 96 | It can be handy just to take a look at the isolated code, but you can 97 | save the code for later use or sharing (e.g. creating a reproducible 98 | example for getting help) with the `write.code` function: 99 | 100 | ```{r eval = FALSE} 101 | my.code <- clean("example/simple_script.R", "tab.15") 102 | write.code(my.code, file = "x.R") 103 | ``` 104 | 105 | If you would like to copy your code to your clipboard, you can do that 106 | by not specifying a file path. You can now paste as needed to create a 107 | simpler script. 108 | 109 | ```{r eval = FALSE} 110 | write.code(my.code) 111 | ``` 112 | 113 | 114 | 115 | ## Retrospective Provenance 116 | 117 | So far, we've been using "prospective" provenance generated from the 118 | static code prior to execution. *Rclean* can also be used with 119 | "retrospective" provenance, which is recorded during execution of a 120 | script. Using it facilitates more accurate code cleaning, We can pass 121 | the provenance to the `clean` function via `options`: 122 | 123 | 124 | ```{r eval = TRUE} 125 | options(prov.json = readLines("example/prov_micro.json")) 126 | ``` 127 | 128 | Now that we have the provenance loaded, we can start 129 | cleaning. [Rclean](https://github.com/ProvTools/Rclean) will give us a 130 | list of possible values we can get code for, notice that the option 131 | *rp* (i.e. "retrospective provenance") has been set to `TRUE`: 132 | 133 | ```{r eval = TRUE} 134 | clean(file = "example/micro.R", rp = TRUE) 135 | ``` 136 | 137 | Similar to before, you can then pick and choose from among these 138 | results and get the essential code to produce the output, like so: 139 | 140 | ```{r eval = TRUE} 141 | clean(file = "example/micro.R", var = "x", rp = TRUE) 142 | ``` 143 | 144 | Happy cleaning! 145 | 146 | -------------------------------------------------------------------------------- /inst/README.rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: md_document 3 | --- 4 | 5 | 6 | 7 | 8 | ```{r setup, echo = FALSE} 9 | knitr::opts_chunk$set( 10 | collapse = TRUE, 11 | comment = "#>", 12 | fig.path = "man/figures/README-" 13 | ) 14 | original_files <- dir() 15 | ``` 16 | 17 | 18 | 19 | 20 | [![Build Status](https://travis-ci.org/ProvTools/Rclean.svg?branch=master)](https://travis-ci.org/ProvTools/Rclean) 21 | [![Coverage status](https://codecov.io/gh/provtools/Rclean/branch/master/graph/badge.svg)](https://codecov.io/github/provtools/Rclean?branch=master) 22 | 23 | 24 | [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/Rclean)](https://cran.r-project.org/package=Rclean) 25 | ![RStudio CRAN downloads](http://cranlogs.r-pkg.org/badges/grand-total/Rclean) 26 | ![RStudio CRAN monthly downloads](http://cranlogs.r-pkg.org/badges/Rclean) 27 | [![Rdocumentation](http://www.rdocumentation.org/badges/version/Rclean)](http://www.rdocumentation.org/packages/Rclean) 28 | 29 | 30 | [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) 31 | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing) 32 | 33 | 34 | [![](https://badges.ropensci.org/327_status.svg)](https://github.com/ropensci/software-review/issues/327) 35 | [![status](http://joss.theoj.org/papers/334d80d5508056dc6e7e17c6fd3ed5a6/status.svg)](http://joss.theoj.org/papers/334d80d5508056dc6e7e17c6fd3ed5a6) 36 | 37 | 38 | [![DOI](https://zenodo.org/badge/102645585.svg)](https://zenodo.org/badge/latestdoi/102645585) 39 | 40 | Clean up your code 41 | ================== 42 | 43 | - Have you ever written a long script in R that conducts lots of 44 | analyses and wished that someone would come along and make it all 45 | clearer to understand and use? 46 | - Well you’re not alone. 47 | - A recent survey of over 1500 scientists reported a crisis of 48 | reproducibility with "selective reporting" being the most cited 49 | contributing factor and 80% saying code availability is playing a 50 | role. 51 | - [Rclean](https://github.com/ProvTools/Rclean) was created to help 52 | scientists more *easily* write "cleaner" code by providing a simple, 53 | rigorous way to isolate the minimal code you need in order to 54 | produce a specific result (e.g. object, plot, output written to 55 | disk). 56 | - [Rclean](https://github.com/ProvTools/Rclean) is built on data 57 | provenance, a formal representation of a computation, and uses graph 58 | analysis to determine the minimal path from inputs to results. 59 | - The goal is to help facilitate code transparency, reproducibility, 60 | reusability and ultimately help scientists spend more time on 61 | research and less time on software. 62 | 63 | Install 64 | ======= 65 | 66 | You can install 67 | [Rclean](https://cran.r-project.org/web/packages/Rclean/) from *CRAN*: 68 | 69 | ```{r eval = FALSE} 70 | install.packages("Rclean") 71 | ``` 72 | 73 | You can install the most up to date version easily with 74 | [devtools](https://github.com/hadley/devtools): 75 | 76 | ```{r eval = FALSE} 77 | install.packages("devtools") 78 | devtools::install_github("ProvTools/Rclean") 79 | ``` 80 | 81 | 82 | Once installed, per usual R practice, just load the *Rclean* package with: 83 | 84 | ```{r eval = TRUE} 85 | library(Rclean) 86 | ``` 87 | 88 | Usage 89 | ===== 90 | 91 | *Rclean* usage is simple. Have a script with code you want to clean 92 | saved to disk. Then, just run the `clean` function with the path to 93 | the script as the input. Here, we can use an example script that is 94 | included with the package: 95 | 96 | ```{r eval = TRUE} 97 | clean("example/simple_script.R") 98 | ``` 99 | 100 | This returns a list of possible results detected in the script, 101 | including execution lines (not counting lines with no code or that are 102 | commented). We can now pick the result we want to focus on for 103 | cleaning: 104 | 105 | 106 | ```{r eval = TRUE} 107 | clean("./example/simple_script.R", "tab.15") 108 | ``` 109 | 110 | This produces the minimal code detected from the script. It also 111 | detects library dependencies and inserts them into the code (`libs = 112 | TRUE`). 113 | 114 | It can be handy just to take a look at the isolated code, but you can 115 | save the code for later use or sharing (e.g. creating a reproducible 116 | example for getting help) with the `write.code` function: 117 | 118 | ```{r eval = FALSE} 119 | my.code <- clean("example/simple_script.R", "tab.15") 120 | write.code(my.code, file = "x.R") 121 | ``` 122 | 123 | If you would like to copy your code to your clipboard, you can do that 124 | by not specifying a file path. You can now paste as needed to create a 125 | simpler script. 126 | 127 | ```{r eval = FALSE} 128 | write.code(my.code) 129 | ``` 130 | 131 | 132 | 133 | ## Retrospective Provenance 134 | 135 | So far, we've been using "prospective" provenance generated from the 136 | static code prior to execution. *Rclean* can also be used with 137 | "retrospective" provenance, which is recorded during execution of a 138 | script. Using it facilitates more accurate code cleaning, We can pass 139 | the provenance to the `clean` function via `options`: 140 | 141 | 142 | ```{r eval = TRUE} 143 | options(prov.json = readLines("example/prov_micro.json")) 144 | ``` 145 | 146 | Now that we have the provenance loaded, we can start 147 | cleaning. [Rclean](https://github.com/ProvTools/Rclean) will give us a 148 | list of possible values we can get code for, notice that the option 149 | *rp* (i.e. "retrospective provenance") has been set to `TRUE`: 150 | 151 | ```{r eval = TRUE} 152 | clean(file = "example/micro.R", rp = TRUE) 153 | ``` 154 | 155 | Similar to before, you can then pick and choose from among these 156 | results and get the essential code to produce the output, like so: 157 | 158 | ```{r eval = TRUE} 159 | clean(file = "example/micro.R", var = "x", rp = TRUE) 160 | ``` 161 | 162 | Happy cleaning! 163 | 164 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | [![Build 5 | Status](https://travis-ci.org/ProvTools/Rclean.svg?branch=master)](https://travis-ci.org/ProvTools/Rclean) 6 | [![Coverage 7 | status](https://codecov.io/gh/provtools/Rclean/branch/master/graph/badge.svg)](https://codecov.io/github/provtools/Rclean?branch=master) 8 | 9 | 10 | [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/Rclean)](https://cran.r-project.org/package=Rclean) 11 | ![RStudio CRAN 12 | downloads](http://cranlogs.r-pkg.org/badges/grand-total/Rclean) 13 | ![RStudio CRAN monthly 14 | downloads](http://cranlogs.r-pkg.org/badges/Rclean) 15 | [![Rdocumentation](http://www.rdocumentation.org/badges/version/Rclean)](http://www.rdocumentation.org/packages/Rclean) 16 | 17 | 18 | [![Project Status: Active – The project has reached a stable, usable 19 | state and is being actively 20 | developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) 21 | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing) 22 | 23 | 24 | [![](https://badges.ropensci.org/327_status.svg)](https://github.com/ropensci/software-review/issues/327) 25 | [![status](http://joss.theoj.org/papers/334d80d5508056dc6e7e17c6fd3ed5a6/status.svg)](http://joss.theoj.org/papers/334d80d5508056dc6e7e17c6fd3ed5a6) 26 | 27 | 28 | [![DOI](https://zenodo.org/badge/102645585.svg)](https://zenodo.org/badge/latestdoi/102645585) 29 | 30 | Clean up your code 31 | ================== 32 | 33 | - Have you ever written a long script in R that conducts lots of 34 | analyses and wished that someone would come along and make it all 35 | clearer to understand and use? 36 | - Well you’re not alone. 37 | - A recent survey of over 1500 scientists reported a crisis of 38 | reproducibility with “selective reporting” being the most cited 39 | contributing factor and 80% saying code availability is playing a 40 | role. 41 | - [Rclean](https://github.com/ProvTools/Rclean) was created to help 42 | scientists more *easily* write “cleaner” code by providing a simple, 43 | rigorous way to isolate the minimal code you need in order to 44 | produce a specific result (e.g. object, plot, output written to 45 | disk). 46 | - [Rclean](https://github.com/ProvTools/Rclean) is built on data 47 | provenance, a formal representation of a computation, and uses graph 48 | analysis to determine the minimal path from inputs to results. 49 | - The goal is to help facilitate code transparency, reproducibility, 50 | reusability and ultimately help scientists spend more time on 51 | research and less time on software. 52 | 53 | Install 54 | ======= 55 | 56 | You can install 57 | [Rclean](https://cran.r-project.org/web/packages/Rclean/) from *CRAN*: 58 | 59 | install.packages("Rclean") 60 | 61 | You can install the most up to date version easily with 62 | [devtools](https://github.com/hadley/devtools): 63 | 64 | install.packages("devtools") 65 | devtools::install_github("ProvTools/Rclean") 66 | 67 | Once installed, per usual R practice, just load the *Rclean* package 68 | with: 69 | 70 | library(Rclean) 71 | 72 | Usage 73 | ===== 74 | 75 | *Rclean* usage is simple. Have a script with code you want to clean 76 | saved to disk. Then, just run the `clean` function with the path to the 77 | script as the input. Here, we can use an example script that is included 78 | with the package: 79 | 80 | clean("example/simple_script.R") 81 | #> [1] Possible results: 82 | #> [1] "1" "2" "3" "4" "5" 83 | #> [6] "6" "7" "8" "9" "10" 84 | #> [11] "11" "12" "13" "14" "15" 85 | #> [16] "16" "mat" "dat" "fit12" "fit13" 86 | #> [21] "fit14" "fit15.aov" "tab.12" "tab.13" "tab.14" 87 | #> [26] "tab.15" "out" 88 | 89 | This returns a list of possible results detected in the script, 90 | including execution lines (not counting lines with no code or that are 91 | commented). We can now pick the result we want to focus on for cleaning: 92 | 93 | clean("./example/simple_script.R", "tab.15") 94 | #> [1] "mat <- matrix(rnorm(400), nrow = 100)" 95 | #> [2] "dat <- as.data.frame(mat)" 96 | #> [3] "dat[, \"V2\"] <- dat[, \"V2\"] + runif(nrow(dat))" 97 | #> [4] "dat[, \"V5\"] <- gl(10, 10)" 98 | #> [5] "fit14 <- lm(V1 ~ V4, data = dat)" 99 | #> [6] "fit15.aov <- aov(V1 ~ V2 + V5, data = dat)" 100 | #> [7] "tab.14 <- summary(fit14)" 101 | #> [8] "tab.15 <- append(fit15.aov, tab.14)" 102 | #> [9] "dat <- 25 + 2" 103 | #> [10] "dat[2] <- 10" 104 | 105 | This produces the minimal code detected from the script. It also detects 106 | library dependencies and inserts them into the code (`libs = TRUE`). 107 | 108 | It can be handy just to take a look at the isolated code, but you can 109 | save the code for later use or sharing (e.g. creating a reproducible 110 | example for getting help) with the `write.code` function: 111 | 112 | my.code <- clean("example/simple_script.R", "tab.15") 113 | write.code(my.code, file = "x.R") 114 | 115 | If you would like to copy your code to your clipboard, you can do that 116 | by not specifying a file path. You can now paste as needed to create a 117 | simpler script. 118 | 119 | write.code(my.code) 120 | 121 | Retrospective Provenance 122 | ------------------------ 123 | 124 | So far, we’ve been using “prospective” provenance generated from the 125 | static code prior to execution. *Rclean* can also be used with 126 | “retrospective” provenance, which is recorded during execution of a 127 | script. Using it facilitates more accurate code cleaning, We can pass 128 | the provenance to the `clean` function via `options`: 129 | 130 | options(prov.json = readLines("example/prov_micro.json")) 131 | 132 | Now that we have the provenance loaded, we can start cleaning. 133 | [Rclean](https://github.com/ProvTools/Rclean) will give us a list of 134 | possible values we can get code for, notice that the option *rp* (i.e. 135 | “retrospective provenance”) has been set to `TRUE`: 136 | 137 | clean(file = "example/micro.R", rp = TRUE) 138 | #> [1] Possible results: 139 | #> [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "x" "y" 140 | 141 | Similar to before, you can then pick and choose from among these results 142 | and get the essential code to produce the output, like so: 143 | 144 | clean(file = "example/micro.R", var = "x", rp = TRUE) 145 | #> [1] "x <- 1" "y <- 3" "x <- x + y" 146 | 147 | Happy cleaning! 148 | -------------------------------------------------------------------------------- /joss/paper.bib: -------------------------------------------------------------------------------- 1 | Automatically generated by Mendeley Desktop 1.19.3 2 | Any changes to this file will be lost if it is regenerated by Mendeley. 3 | 4 | BibTeX export options can be customized via Preferences -> BibTeX in Mendeley Desktop 5 | 6 | @article{Carata2014, 7 | author = {Carata, Lucian and Akoush, Sherif and Balakrishnan, Nikilesh and Bytheway, Thomas and Sohan, Ripduman and Seltzer, Margo and Hopper, Andy}, 8 | doi = {10.1145/2602649.2602651}, 9 | file = {:Users/hermes/Library/Application Support/Mendeley Desktop/Downloaded/Carata et al. - 2014 - A Primer on Provenance.pdf:pdf}, 10 | issn = {15427730}, 11 | journal = {Queue}, 12 | month = {mar}, 13 | number = {3}, 14 | pages = {10--23}, 15 | publisher = {ACM}, 16 | title = {{A Primer on Provenance}}, 17 | url = {http://dl.acm.org/citation.cfm?doid=2602649.2602651}, 18 | volume = {12}, 19 | year = {2014} 20 | } 21 | @article{Pasquier2018, 22 | author = {Pasquier, Thomas and Lau, Matthew K. and Han, Xueyuan and Fong, Elizabeth and Lerner, Barbara S. and Boose, Emery R. and Crosas, Merce and Ellison, Aaron M. and Seltzer, Margo}, 23 | doi = {10.1109/MCSE.2018.042781334}, 24 | issn = {1521-9615}, 25 | journal = {Comput. Sci. Eng.}, 26 | month = {jul}, 27 | number = {4}, 28 | pages = {111--124}, 29 | title = {{Sharing and Preserving Computational Analyses for Posterity with encapsulator}}, 30 | url = {https://ieeexplore.ieee.org/document/8409369/}, 31 | volume = {20}, 32 | year = {2018} 33 | } 34 | @article{Baker2016, 35 | author = {Baker, Monya}, 36 | doi = {10.1038/533452a}, 37 | journal = {Nature}, 38 | pages = {452--454}, 39 | title = {1,500 scientists lift the lid on reproducibility}, 40 | url = {https://www.nature.com/news/1-500-scientists-lift-the-lid-on-reproducibility-1.19970}, 41 | volume = {533}, 42 | year = {2016} 43 | } 44 | @article{Peng2011, 45 | abstract = {Computational science has led to exciting new developments, but the nature of the work has exposed limitations in our ability to evaluate published findings. Reproducibility has the potential to serve as a minimum standard for judging scientific claims when full independent replication of a study is not possible.}, 46 | author = {Peng, Roger D and Hanson, B. and Sugden, A. and Alberts, B. and Peng, R. D. and Dominici, F. and Zeger, S. L. and Schwab, M. and Karrenbach, N. and Claerbout, J. and Laine, C. and Goodman, S. N. and Griswold, M. E. and Sox, H. C. and King, G. and Sharing, . Yale Law School Roundtable on Data and Code and Ioannidis, J. P. A. and Mesirov, J. P. and Peng, R. D. and McCullough, B. D. and McGeary, K. A. and Harrison, T. D. and Barnes, N.}, 47 | doi = {10.1126/science.1213847}, 48 | file = {:Users/hermes/Library/Application Support/Mendeley Desktop/Downloaded/Peng et al. - 2011 - Reproducible research in computational science.pdf:pdf}, 49 | issn = {1095-9203}, 50 | journal = {Science}, 51 | month = {dec}, 52 | number = {6060}, 53 | pages = {1226--7}, 54 | pmid = {22144613}, 55 | publisher = {American Association for the Advancement of Science}, 56 | title = {{Reproducible research in computational science.}}, 57 | url = {http://www.ncbi.nlm.nih.gov/pubmed/22144613 http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=PMC3383002}, 58 | volume = {334}, 59 | year = {2011} 60 | } 61 | @article{Pasquier2017, 62 | author = {Pasquier, Thomas and Lau, Matthew K. and Trisovic, Ana and Boose, Emery R. and Couturier, Ben and Crosas, Merc{\`{e}} and Ellison, Aaron M. and Gibson, Valerie and Jones, Chris R. and Seltzer, Margo}, 63 | doi = {10.1038/sdata.2017.114}, 64 | issn = {2052-4463}, 65 | journal = {Sci. Data}, 66 | month = {sep}, 67 | pages = {170114}, 68 | title = {{If these data could talk}}, 69 | url = {http://www.nature.com/articles/sdata2017114}, 70 | volume = {4}, 71 | year = {2017} 72 | } 73 | @article{Chen2018, 74 | abstract = {The solutions adopted by the high-energy physics community to foster reproducible research are examples of best practices that could be embraced more widely. This first experience suggests that reproducibility requires going beyond openness.}, 75 | author = {Chen, Xiaoli and Dallmeier-Tiessen, S{\"{u}}nje and Dasler, Robin and Feger, Sebastian and Fokianos, Pamfilos and Gonzalez, Jose Benito and Hirvonsalo, Harri and Kousidis, Dinos and Lavasa, Artemis and Mele, Salvatore and Rodriguez, Diego Rodriguez and {\v{S}}imko, Tibor and Smith, Tim and Trisovic, Ana and Trzcinska, Anna and Tsanaktsidis, Ioannis and Zimmermann, Markus and Cranmer, Kyle and Heinrich, Lukas and Watts, Gordon and Hildreth, Michael and {Lloret Iglesias}, Lara and Lassila-Perini, Kati and Neubert, Sebastian}, 76 | doi = {10.1038/s41567-018-0342-2}, 77 | file = {:Users/hermes/Library/Application Support/Mendeley Desktop/Downloaded/Chen et al. - 2018 - Open is not enough.pdf:pdf}, 78 | issn = {1745-2473}, 79 | journal = {Nat. Phys.}, 80 | keywords = {Particle physics,Publishing,Research management}, 81 | month = {nov}, 82 | pages = {1}, 83 | publisher = {Nature Publishing Group}, 84 | title = {{Open is not enough}}, 85 | url = {http://www.nature.com/articles/s41567-018-0342-2}, 86 | year = {2018} 87 | } 88 | @article{Lau2018, 89 | author = {Lau, Matthew K.}, 90 | journal = {Compr. R Arch. Netw.}, 91 | title = {{Rclean: A Tool for Writing Cleaner, more Transparent Code}}, 92 | url = {https://cran.r-project.org/package=Rclean}, 93 | year = {2018} 94 | } 95 | @article{Visser2015, 96 | annote = {NULL}, 97 | author = {Visser, Marco D. and McMahon, Sean M. and Merow, Cory and Dixon, Philip M. and Record, Sydne and Jongejans, Eelke}, 98 | doi = {10.1371/journal.pcbi.1004140}, 99 | editor = {Ouellette, Francis}, 100 | file = {:Users/hermes/Library/Application Support/Mendeley Desktop/Downloaded/Visser et al. - 2015 - Speeding Up Ecological and Evolutionary Computations in R Essentials of High Performance Computing for Biologi(2).pdf:pdf}, 101 | issn = {1553-7358}, 102 | journal = {PLOS Comput. Biol.}, 103 | month = {mar}, 104 | number = {3}, 105 | pages = {e1004140}, 106 | publisher = {Springer-Verlag}, 107 | title = {{Speeding Up Ecological and Evolutionary Computations in R; Essentials of High Performance Computing for Biologists}}, 108 | url = {http://dx.plos.org/10.1371/journal.pcbi.1004140}, 109 | volume = {11}, 110 | year = {2015} 111 | } 112 | @article{Stodden2018, 113 | abstract = {A key component of scientific communication is sufficient information for other researchers in the field to reproduce published findings. For computational and data-enabled research, this has often been interpreted to mean making available the raw data from which results were generated, the computer code that generated the findings, and any additional information needed such as workflows and input parameters. Many journals are revising author guidelines to include data and code availability. This work evaluates the effectiveness of journal policy that requires the data and code necessary for reproducibility be made available postpublication by the authors upon request. We assess the effectiveness of such a policy by (i) requesting data and code from authors and (ii) attempting replication of the published findings. We chose a random sample of 204 scientific papers published in the journalScienceafter the implementation of their policy in February 2011. We found that we were able to obtain artifacts from 44% of our sample and were able to reproduce the findings for 26%. We find this policy-author remission of data and code postpublication upon request-an improvement over no policy, but currently insufficient for reproducibility.}, 114 | author = {Stodden, Victoria and Seiler, Jennifer and Ma, Zhaokun}, 115 | doi = {10.1073/pnas.1708290115}, 116 | file = {:Users/hermes/Library/Application Support/Mendeley Desktop/Downloaded/Stodden, Seiler, Ma - 2018 - An empirical analysis of journal policy effectiveness for computational reproducibility.pdf:pdf}, 117 | issn = {1091-6490}, 118 | journal = {Proc. Natl. Acad. Sci. U. S. A.}, 119 | keywords = {code access,data access,open science,reproducibility policy,reproducible research}, 120 | month = {mar}, 121 | number = {11}, 122 | pages = {2584--2589}, 123 | pmid = {29531050}, 124 | publisher = {National Academy of Sciences}, 125 | title = {{An empirical analysis of journal policy effectiveness for computational reproducibility.}}, 126 | url = {http://www.ncbi.nlm.nih.gov/pubmed/29531050}, 127 | volume = {115}, 128 | year = {2018} 129 | } 130 | -------------------------------------------------------------------------------- /R/clean.R: -------------------------------------------------------------------------------- 1 | # This file is part of Rclean 2 | # 3 | # Rclean is free software; you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License 5 | # as published by the Free Software Foundation; either version 2 6 | # of the License, or (at your option) any later version. 7 | # 8 | # Rclean is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Rclean; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | # 17 | # Contact: Matthew Lau 18 | 19 | #' clean --- Clean code. 20 | #' 21 | #' Reduce the size and complexity of a analytical script through 22 | #' algorithmic detection of the essential code needed to produce a set 23 | #' of results. 24 | #' 25 | #'@param file File path to a script. 26 | #'@param var The name of a variable of interest. 27 | #'@param libs LOGICAL: should library dependencies be detected and 28 | #' included? 29 | #'@param reformat LOGICAL: should the minimized code be re-formatted 30 | #' following common syntax? 31 | #'@param plot LOGICAL: should a network diagram of the cleaned script 32 | #' be produced? 33 | #'@param rp LOGICAL: should retrospective provenance be used? This 34 | #' should be made available in JSON format as an object within 35 | #' options (i.e. options(prov.json = ). 37 | #'@return A character vector containing a minimized script based on 38 | #' the given input variable. 39 | #'@importFrom CodeDepends getInputs 40 | #'@importFrom CodeDepends readScript 41 | #'@importFrom formatR tidy_source 42 | #'@importFrom utils capture.output 43 | #'@importFrom utils tail 44 | #'@export clean 45 | #'@author Matthew K. Lau 46 | 47 | clean <- function(file, var, libs = TRUE, reformat = TRUE, plot = FALSE, rp = FALSE){ 48 | if (!(rp) & missing(file)){ 49 | warning("Please provide a script file path.") 50 | }else{ 51 | if (missing(var)){ 52 | print("Possible results:", quote = FALSE) 53 | rownames(var.lineage(readScript(file))[["g"]]) 54 | }else{ 55 | if (!(rp)){ 56 | src <- readScript(file) 57 | vl <- var.lineage(src) 58 | sp <- p.spine(vl, var) 59 | min.g <- vl[["g"]][rownames(vl[["g"]]) %in% as.character(sp), 60 | colnames(vl[["g"]]) %in% as.character(sp)] 61 | sp <- sp[sp %in% as.character(unique(vl[["vdf"]][, "step"]))] 62 | sp <- sort(as.numeric(sp)) 63 | min.src <- as.character(src[sp]) 64 | if (libs){ 65 | lib.l <- get.libs(src) 66 | lib.l <- unique(lib.l) 67 | if (length(lib.l) != 0){ 68 | lib.src <- paste0("library(", lib.l, ")") 69 | out <- c(lib.src, min.src) 70 | }else{out <- min.src} 71 | }else{ 72 | out <- min.src 73 | } 74 | # Re-formatting the code using formatR 75 | if (reformat){ 76 | capture.output( 77 | out <- 78 | tidy_source(text = out)$text.tidy 79 | ) 80 | } 81 | if (plot){ 82 | codeGraph(min.g) 83 | } 84 | return(out) 85 | }else{ 86 | ## Get provenance for script 87 | ## Check if the provenance is in memory 88 | if ("prov.json" %in% names(options())){ 89 | prov <- read.prov(options()$prov.json) 90 | }else{ 91 | warning("Please add options(prov.json = PROV.JSON)") 92 | } 93 | ## Check that specified file matches provenance file before reading 94 | if (!(grepl(prov$info$activity[1,1], file))){ 95 | print("Specified script does not match provenance.") 96 | }else{ 97 | script <- readLines(file) 98 | } 99 | ## Get result options 100 | ## Output files 101 | result.files <- unlist( 102 | prov$info$entity[prov$info$entity[,4] == "File", 1] 103 | ) 104 | ## Remove files that are inputs 105 | result.files <- result.files[ 106 | names(result.files) %in% 107 | names(which(apply(prov$graph,2,sum) == 0))] 108 | result.files <- as.character(result.files) 109 | ## Get objects for suggested results 110 | result.obj <- unlist(prov$info$entity[,1]) 111 | ## Removing dev.off calls 112 | result.obj <- result.obj[!(grepl("dev.", result.obj) & 113 | prov$info$entity[,2] == "\"graph\"")] 114 | ## Remove output files 115 | result.obj <- result.obj[names(result.obj) %in% 116 | rownames(prov$info$entity)[ 117 | prov$info$entity[,4] != "File"]] 118 | result.obj <- as.character(result.obj) 119 | ## Combine vectors 120 | result.opts <- list(Files = unique(result.files), 121 | Objects = unique(result.obj)) 122 | ## If result is NULL then prompt 123 | if ((var == "Name of desired result") | 124 | !(var %in% unlist(result.opts))){ 125 | print("Possible results:", quote = FALSE) 126 | ## Convert to simple character vector 127 | result.opts 128 | }else{ 129 | ## Get the node that matches the result name 130 | node.id <- tail(n = 1, 131 | rownames(prov$info$entity)[ 132 | prov$info$entity[,1] == var] 133 | ) 134 | ## Graph search for the path from the result to inputs 135 | spine <- get.spine(node.id, prov$g) 136 | ## min.script == the minimum code to produce the output 137 | ## Get the line numbers from the original source code 138 | lines <- prov$info$activity[ 139 | grep("p",spine, value = TRUE), 140 | grep("Line", 141 | colnames(prov$info$activity))] 142 | # If the result is created on 143 | # a single line, coerce to a matrix 144 | if (length(grep("p", spine)) == 1){ 145 | lines <- as.numeric(lines) 146 | lines <- t(as.matrix(lines)) 147 | }else{lines <- apply(lines, 2, as.numeric)} 148 | rownames(lines) <- grep("p", spine, value = TRUE) 149 | ## Remove processes which don't involve the creation of data 150 | rm.p <- sapply(prov$info$activity[,1], 151 | function(p, d) any(sapply(d, grepl, x = p)), 152 | d = prov$info$entity[,1]) 153 | rm.p <- names(rm.p)[!(rm.p)] 154 | lines <- lines[!(rownames(lines) %in% rm.p),] 155 | if (length(grep("p", spine)) == 1){ 156 | lines <- as.numeric(lines) 157 | lines <- t(as.matrix(lines)) 158 | }else{ 159 | node.rank <- as.numeric(gsub("p", "", rownames(lines))) 160 | lines <- lines[order(node.rank),] 161 | } 162 | ## Extract the minimal code 163 | min.script <- apply(lines, 1, function(line, src) 164 | src[seq(line[1], line[2])], 165 | src = script) 166 | min.script <- unlist(min.script) 167 | min.script <- as.character(min.script) 168 | ## Check for graphics out 169 | plot.code <- sapply(c("jpeg", "png", "tiff", "pdf", "bmp"), 170 | grepl, x = min.script) 171 | if (any(plot.code)){ 172 | min.script <- c(min.script, "dev.off()") 173 | } 174 | ## Tidying the code using formatR 175 | if (reformat){ 176 | capture.output( 177 | min.script <- 178 | tidy_source(text = min.script)$text.tidy 179 | ) 180 | } 181 | out <- min.script 182 | return(out) 183 | } 184 | } 185 | } 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /exec/micro_R.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "prefix" : { 4 | "prov" : "http://www.w3.org/ns/prov#", 5 | "rdt" : "http://rdatatracker.org/" 6 | }, 7 | "activity":{ 8 | 9 | "p1" : { 10 | "rdt:name" : "micro.R", 11 | "rdt:type" : "Start", 12 | "rdt:elapsedTime" : "0.241", 13 | "rdt:scriptNum" : "NA", 14 | "rdt:startLine" : "NA", 15 | "rdt:startCol" : "NA", 16 | "rdt:endLine" : "NA", 17 | "rdt:endCol" : "NA" 18 | } , 19 | 20 | "p2" : { 21 | "rdt:name" : "x <- 1", 22 | "rdt:type" : "Operation", 23 | "rdt:elapsedTime" : "0.279", 24 | "rdt:scriptNum" : "0", 25 | "rdt:startLine" : "1", 26 | "rdt:startCol" : "1", 27 | "rdt:endLine" : "1", 28 | "rdt:endCol" : "5" 29 | } , 30 | 31 | "p3" : { 32 | "rdt:name" : "y <- 3", 33 | "rdt:type" : "Operation", 34 | "rdt:elapsedTime" : "0.403", 35 | "rdt:scriptNum" : "0", 36 | "rdt:startLine" : "2", 37 | "rdt:startCol" : "1", 38 | "rdt:endLine" : "2", 39 | "rdt:endCol" : "5" 40 | } , 41 | 42 | "p4" : { 43 | "rdt:name" : "10", 44 | "rdt:type" : "Operation", 45 | "rdt:elapsedTime" : "0.791", 46 | "rdt:scriptNum" : "0", 47 | "rdt:startLine" : "3", 48 | "rdt:startCol" : "1", 49 | "rdt:endLine" : "3", 50 | "rdt:endCol" : "2" 51 | } , 52 | 53 | "p5" : { 54 | "rdt:name" : "x", 55 | "rdt:type" : "Operation", 56 | "rdt:elapsedTime" : "0.793", 57 | "rdt:scriptNum" : "0", 58 | "rdt:startLine" : "4", 59 | "rdt:startCol" : "1", 60 | "rdt:endLine" : "4", 61 | "rdt:endCol" : "1" 62 | } , 63 | 64 | "p6" : { 65 | "rdt:name" : "x <- x + y", 66 | "rdt:type" : "Operation", 67 | "rdt:elapsedTime" : "0.803", 68 | "rdt:scriptNum" : "0", 69 | "rdt:startLine" : "5", 70 | "rdt:startCol" : "1", 71 | "rdt:endLine" : "5", 72 | "rdt:endCol" : "7" 73 | } , 74 | 75 | "p7" : { 76 | "rdt:name" : "x", 77 | "rdt:type" : "Operation", 78 | "rdt:elapsedTime" : "0.885", 79 | "rdt:scriptNum" : "0", 80 | "rdt:startLine" : "6", 81 | "rdt:startCol" : "1", 82 | "rdt:endLine" : "6", 83 | "rdt:endCol" : "1" 84 | } , 85 | 86 | "p8" : { 87 | "rdt:name" : "y^3", 88 | "rdt:type" : "Operation", 89 | "rdt:elapsedTime" : "0.895", 90 | "rdt:scriptNum" : "0", 91 | "rdt:startLine" : "7", 92 | "rdt:startCol" : "1", 93 | "rdt:endLine" : "7", 94 | "rdt:endCol" : "3" 95 | } , 96 | 97 | "p9" : { 98 | "rdt:name" : "write.csv(x, \"~/test.test\")", 99 | "rdt:type" : "Operation", 100 | "rdt:elapsedTime" : "0.913", 101 | "rdt:scriptNum" : "0", 102 | "rdt:startLine" : "8", 103 | "rdt:startCol" : "1", 104 | "rdt:endLine" : "8", 105 | "rdt:endCol" : "26" 106 | } , 107 | 108 | "p10" : { 109 | "rdt:name" : "pdf(\"~/test.pdf\")", 110 | "rdt:type" : "Operation", 111 | "rdt:elapsedTime" : "1.014", 112 | "rdt:scriptNum" : "0", 113 | "rdt:startLine" : "10", 114 | "rdt:startCol" : "1", 115 | "rdt:endLine" : "10", 116 | "rdt:endCol" : "17" 117 | } , 118 | 119 | "p11" : { 120 | "rdt:name" : "plot(x)", 121 | "rdt:type" : "Operation", 122 | "rdt:elapsedTime" : "1.034", 123 | "rdt:scriptNum" : "0", 124 | "rdt:startLine" : "11", 125 | "rdt:startCol" : "1", 126 | "rdt:endLine" : "11", 127 | "rdt:endCol" : "7" 128 | } , 129 | 130 | "p12" : { 131 | "rdt:name" : "dev.off()", 132 | "rdt:type" : "Operation", 133 | "rdt:elapsedTime" : "1.061", 134 | "rdt:scriptNum" : "0", 135 | "rdt:startLine" : "12", 136 | "rdt:startCol" : "1", 137 | "rdt:endLine" : "12", 138 | "rdt:endCol" : "9" 139 | } , 140 | 141 | "p13" : { 142 | "rdt:name" : "micro.R", 143 | "rdt:type" : "Finish", 144 | "rdt:elapsedTime" : "1.096", 145 | "rdt:scriptNum" : "NA", 146 | "rdt:startLine" : "NA", 147 | "rdt:startCol" : "NA", 148 | "rdt:endLine" : "NA", 149 | "rdt:endCol" : "NA" 150 | } , 151 | 152 | "environment" : { 153 | "rdt:name" : "environment", 154 | "rdt:architecture" : "x86_64", 155 | "rdt:operatingSystem" : "unix", 156 | "rdt:language" : "R", 157 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 158 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 159 | "rdt:sourcedScripts" : "" 160 | , 161 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 162 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 163 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 164 | "rdt:provRVersion" : "0.1.0", 165 | "rdt:installedPackages" : [ 166 | {"package" : "base", "version" : "3.4.3"}, 167 | {"package" : "datasets", "version" : "3.4.3"}, 168 | {"package" : "devtools", "version" : "1.13.5"}, 169 | {"package" : "graphics", "version" : "3.4.3"}, 170 | {"package" : "grDevices", "version" : "3.4.3"}, 171 | {"package" : "methods", "version" : "3.4.3"}, 172 | {"package" : "provR", "version" : "0.1.0"}, 173 | {"package" : "stats", "version" : "3.4.3"}, 174 | {"package" : "utils", "version" : "3.4.3"}] 175 | } , 176 | 177 | "environment" : { 178 | "rdt:name" : "environment", 179 | "rdt:architecture" : "x86_64", 180 | "rdt:operatingSystem" : "unix", 181 | "rdt:language" : "R", 182 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 183 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 184 | "rdt:sourcedScripts" : "" 185 | , 186 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 187 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 188 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 189 | "rdt:provRVersion" : "0.1.0", 190 | "rdt:installedPackages" : [ 191 | {"package" : "base", "version" : "3.4.3"}, 192 | {"package" : "datasets", "version" : "3.4.3"}, 193 | {"package" : "devtools", "version" : "1.13.5"}, 194 | {"package" : "graphics", "version" : "3.4.3"}, 195 | {"package" : "grDevices", "version" : "3.4.3"}, 196 | {"package" : "methods", "version" : "3.4.3"}, 197 | {"package" : "provR", "version" : "0.1.0"}, 198 | {"package" : "stats", "version" : "3.4.3"}, 199 | {"package" : "utils", "version" : "3.4.3"}] 200 | } , 201 | 202 | "environment" : { 203 | "rdt:name" : "environment", 204 | "rdt:architecture" : "x86_64", 205 | "rdt:operatingSystem" : "unix", 206 | "rdt:language" : "R", 207 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 208 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 209 | "rdt:sourcedScripts" : "" 210 | , 211 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 212 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 213 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 214 | "rdt:provRVersion" : "0.1.0", 215 | "rdt:installedPackages" : [ 216 | {"package" : "base", "version" : "3.4.3"}, 217 | {"package" : "datasets", "version" : "3.4.3"}, 218 | {"package" : "devtools", "version" : "1.13.5"}, 219 | {"package" : "graphics", "version" : "3.4.3"}, 220 | {"package" : "grDevices", "version" : "3.4.3"}, 221 | {"package" : "methods", "version" : "3.4.3"}, 222 | {"package" : "provR", "version" : "0.1.0"}, 223 | {"package" : "stats", "version" : "3.4.3"}, 224 | {"package" : "utils", "version" : "3.4.3"}] 225 | } , 226 | 227 | "environment" : { 228 | "rdt:name" : "environment", 229 | "rdt:architecture" : "x86_64", 230 | "rdt:operatingSystem" : "unix", 231 | "rdt:language" : "R", 232 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 233 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 234 | "rdt:sourcedScripts" : "" 235 | , 236 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 237 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec", 238 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 239 | "rdt:provRVersion" : "0.1.0", 240 | "rdt:installedPackages" : [ 241 | {"package" : "base", "version" : "3.4.3"}, 242 | {"package" : "datasets", "version" : "3.4.3"}, 243 | {"package" : "devtools", "version" : "1.13.5"}, 244 | {"package" : "formatR", "version" : "1.5"}, 245 | {"package" : "graphics", "version" : "3.4.3"}, 246 | {"package" : "grDevices", "version" : "3.4.3"}, 247 | {"package" : "igraph", "version" : "1.1.2"}, 248 | {"package" : "methods", "version" : "3.4.3"}, 249 | {"package" : "provR", "version" : "0.1.0"}, 250 | {"package" : "stats", "version" : "3.4.3"}, 251 | {"package" : "utils", "version" : "3.4.3"}] 252 | }}, 253 | "entity":{ 254 | 255 | "d1" : { 256 | "rdt:name" : "x", 257 | "rdt:value" : "1", 258 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 259 | "rdt:type" : "Data", 260 | "rdt:scope" : "R_GlobalEnv", 261 | "rdt:fromEnv" : "FALSE", 262 | "rdt:MD5hash" : "", 263 | "rdt:timestamp" : "", 264 | "rdt:location" : "" 265 | } , 266 | 267 | "d2" : { 268 | "rdt:name" : "y", 269 | "rdt:value" : "3", 270 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 271 | "rdt:type" : "Data", 272 | "rdt:scope" : "R_GlobalEnv", 273 | "rdt:fromEnv" : "FALSE", 274 | "rdt:MD5hash" : "", 275 | "rdt:timestamp" : "", 276 | "rdt:location" : "" 277 | } , 278 | 279 | "d3" : { 280 | "rdt:name" : "x", 281 | "rdt:value" : "4", 282 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 283 | "rdt:type" : "Data", 284 | "rdt:scope" : "R_GlobalEnv", 285 | "rdt:fromEnv" : "FALSE", 286 | "rdt:MD5hash" : "", 287 | "rdt:timestamp" : "", 288 | "rdt:location" : "" 289 | } , 290 | 291 | "d4" : { 292 | "rdt:name" : "test.test", 293 | "rdt:value" : "data/4-test.test", 294 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 295 | "rdt:type" : "File", 296 | "rdt:scope" : "undefined", 297 | "rdt:fromEnv" : "FALSE", 298 | "rdt:MD5hash" : "NA", 299 | "rdt:timestamp" : "2018-03-19T12.21.18EDT", 300 | "rdt:location" : "/Users/hermes/test.test" 301 | } , 302 | 303 | "d5" : { 304 | "rdt:name" : "dev.2", 305 | "rdt:value" : "\"graph\"", 306 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 307 | "rdt:type" : "Data", 308 | "rdt:scope" : "undefined", 309 | "rdt:fromEnv" : "FALSE", 310 | "rdt:MD5hash" : "", 311 | "rdt:timestamp" : "", 312 | "rdt:location" : "" 313 | } , 314 | 315 | "d6" : { 316 | "rdt:name" : "dev.2", 317 | "rdt:value" : "\"graph\"", 318 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 319 | "rdt:type" : "Data", 320 | "rdt:scope" : "undefined", 321 | "rdt:fromEnv" : "FALSE", 322 | "rdt:MD5hash" : "", 323 | "rdt:timestamp" : "", 324 | "rdt:location" : "" 325 | } , 326 | 327 | "d7" : { 328 | "rdt:name" : "test.pdf", 329 | "rdt:value" : "data/7-test.pdf", 330 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 331 | "rdt:type" : "File", 332 | "rdt:scope" : "undefined", 333 | "rdt:fromEnv" : "FALSE", 334 | "rdt:MD5hash" : "NA", 335 | "rdt:timestamp" : "2018-03-19T12.21.18EDT", 336 | "rdt:location" : "/Users/hermes/test.pdf" 337 | }}, 338 | "wasInformedBy":{ 339 | 340 | "e1" : { 341 | "prov:informant" : "p1", 342 | "prov:informed" : "p2" 343 | } , 344 | 345 | "e3" : { 346 | "prov:informant" : "p2", 347 | "prov:informed" : "p3" 348 | } , 349 | 350 | "e5" : { 351 | "prov:informant" : "p3", 352 | "prov:informed" : "p4" 353 | } , 354 | 355 | "e6" : { 356 | "prov:informant" : "p4", 357 | "prov:informed" : "p5" 358 | } , 359 | 360 | "e8" : { 361 | "prov:informant" : "p5", 362 | "prov:informed" : "p6" 363 | } , 364 | 365 | "e12" : { 366 | "prov:informant" : "p6", 367 | "prov:informed" : "p7" 368 | } , 369 | 370 | "e14" : { 371 | "prov:informant" : "p7", 372 | "prov:informed" : "p8" 373 | } , 374 | 375 | "e16" : { 376 | "prov:informant" : "p8", 377 | "prov:informed" : "p9" 378 | } , 379 | 380 | "e19" : { 381 | "prov:informant" : "p9", 382 | "prov:informed" : "p10" 383 | } , 384 | 385 | "e21" : { 386 | "prov:informant" : "p10", 387 | "prov:informed" : "p11" 388 | } , 389 | 390 | "e25" : { 391 | "prov:informant" : "p11", 392 | "prov:informed" : "p12" 393 | } , 394 | 395 | "e28" : { 396 | "prov:informant" : "p12", 397 | "prov:informed" : "p13" 398 | }}, 399 | "wasGeneratedBy":{ 400 | 401 | "e2" : { 402 | "prov:entity" : "d1", 403 | "prov:activity" : "p2" 404 | } , 405 | 406 | "e4" : { 407 | "prov:entity" : "d2", 408 | "prov:activity" : "p3" 409 | } , 410 | 411 | "e11" : { 412 | "prov:entity" : "d3", 413 | "prov:activity" : "p6" 414 | } , 415 | 416 | "e18" : { 417 | "prov:entity" : "d4", 418 | "prov:activity" : "p9" 419 | } , 420 | 421 | "e20" : { 422 | "prov:entity" : "d5", 423 | "prov:activity" : "p10" 424 | } , 425 | 426 | "e24" : { 427 | "prov:entity" : "d6", 428 | "prov:activity" : "p11" 429 | } , 430 | 431 | "e26" : { 432 | "prov:entity" : "d7", 433 | "prov:activity" : "p12" 434 | }}, 435 | "used":{ 436 | 437 | "e7" : { 438 | "prov:activity" : "p5", 439 | "prov:entity" : "d1" 440 | } , 441 | 442 | "e9" : { 443 | "prov:activity" : "p6", 444 | "prov:entity" : "d1" 445 | } , 446 | 447 | "e10" : { 448 | "prov:activity" : "p6", 449 | "prov:entity" : "d2" 450 | } , 451 | 452 | "e13" : { 453 | "prov:activity" : "p7", 454 | "prov:entity" : "d3" 455 | } , 456 | 457 | "e15" : { 458 | "prov:activity" : "p8", 459 | "prov:entity" : "d2" 460 | } , 461 | 462 | "e17" : { 463 | "prov:activity" : "p9", 464 | "prov:entity" : "d3" 465 | } , 466 | 467 | "e22" : { 468 | "prov:activity" : "p11", 469 | "prov:entity" : "d3" 470 | } , 471 | 472 | "e23" : { 473 | "prov:activity" : "p11", 474 | "prov:entity" : "d5" 475 | } , 476 | 477 | "e27" : { 478 | "prov:activity" : "p12", 479 | "prov:entity" : "d6" 480 | }} 481 | } 482 | -------------------------------------------------------------------------------- /example/prov_micro.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "prefix" : { 4 | "prov" : "http://www.w3.org/ns/prov#", 5 | "rdt" : "http://rdatatracker.org/" 6 | }, 7 | "activity":{ 8 | 9 | "p1" : { 10 | "rdt:name" : "micro.R", 11 | "rdt:type" : "Start", 12 | "rdt:elapsedTime" : "0.241", 13 | "rdt:scriptNum" : "NA", 14 | "rdt:startLine" : "NA", 15 | "rdt:startCol" : "NA", 16 | "rdt:endLine" : "NA", 17 | "rdt:endCol" : "NA" 18 | } , 19 | 20 | "p2" : { 21 | "rdt:name" : "x <- 1", 22 | "rdt:type" : "Operation", 23 | "rdt:elapsedTime" : "0.279", 24 | "rdt:scriptNum" : "0", 25 | "rdt:startLine" : "1", 26 | "rdt:startCol" : "1", 27 | "rdt:endLine" : "1", 28 | "rdt:endCol" : "5" 29 | } , 30 | 31 | "p3" : { 32 | "rdt:name" : "y <- 3", 33 | "rdt:type" : "Operation", 34 | "rdt:elapsedTime" : "0.403", 35 | "rdt:scriptNum" : "0", 36 | "rdt:startLine" : "2", 37 | "rdt:startCol" : "1", 38 | "rdt:endLine" : "2", 39 | "rdt:endCol" : "5" 40 | } , 41 | 42 | "p4" : { 43 | "rdt:name" : "10", 44 | "rdt:type" : "Operation", 45 | "rdt:elapsedTime" : "0.791", 46 | "rdt:scriptNum" : "0", 47 | "rdt:startLine" : "3", 48 | "rdt:startCol" : "1", 49 | "rdt:endLine" : "3", 50 | "rdt:endCol" : "2" 51 | } , 52 | 53 | "p5" : { 54 | "rdt:name" : "x", 55 | "rdt:type" : "Operation", 56 | "rdt:elapsedTime" : "0.793", 57 | "rdt:scriptNum" : "0", 58 | "rdt:startLine" : "4", 59 | "rdt:startCol" : "1", 60 | "rdt:endLine" : "4", 61 | "rdt:endCol" : "1" 62 | } , 63 | 64 | "p6" : { 65 | "rdt:name" : "x <- x + y", 66 | "rdt:type" : "Operation", 67 | "rdt:elapsedTime" : "0.803", 68 | "rdt:scriptNum" : "0", 69 | "rdt:startLine" : "5", 70 | "rdt:startCol" : "1", 71 | "rdt:endLine" : "5", 72 | "rdt:endCol" : "7" 73 | } , 74 | 75 | "p7" : { 76 | "rdt:name" : "x", 77 | "rdt:type" : "Operation", 78 | "rdt:elapsedTime" : "0.885", 79 | "rdt:scriptNum" : "0", 80 | "rdt:startLine" : "6", 81 | "rdt:startCol" : "1", 82 | "rdt:endLine" : "6", 83 | "rdt:endCol" : "1" 84 | } , 85 | 86 | "p8" : { 87 | "rdt:name" : "y^3", 88 | "rdt:type" : "Operation", 89 | "rdt:elapsedTime" : "0.895", 90 | "rdt:scriptNum" : "0", 91 | "rdt:startLine" : "7", 92 | "rdt:startCol" : "1", 93 | "rdt:endLine" : "7", 94 | "rdt:endCol" : "3" 95 | } , 96 | 97 | "p9" : { 98 | "rdt:name" : "write.csv(x, \"~/test.test\")", 99 | "rdt:type" : "Operation", 100 | "rdt:elapsedTime" : "0.913", 101 | "rdt:scriptNum" : "0", 102 | "rdt:startLine" : "8", 103 | "rdt:startCol" : "1", 104 | "rdt:endLine" : "8", 105 | "rdt:endCol" : "26" 106 | } , 107 | 108 | "p10" : { 109 | "rdt:name" : "pdf(\"~/test.pdf\")", 110 | "rdt:type" : "Operation", 111 | "rdt:elapsedTime" : "1.014", 112 | "rdt:scriptNum" : "0", 113 | "rdt:startLine" : "10", 114 | "rdt:startCol" : "1", 115 | "rdt:endLine" : "10", 116 | "rdt:endCol" : "17" 117 | } , 118 | 119 | "p11" : { 120 | "rdt:name" : "plot(x)", 121 | "rdt:type" : "Operation", 122 | "rdt:elapsedTime" : "1.034", 123 | "rdt:scriptNum" : "0", 124 | "rdt:startLine" : "11", 125 | "rdt:startCol" : "1", 126 | "rdt:endLine" : "11", 127 | "rdt:endCol" : "7" 128 | } , 129 | 130 | "p12" : { 131 | "rdt:name" : "dev.off()", 132 | "rdt:type" : "Operation", 133 | "rdt:elapsedTime" : "1.061", 134 | "rdt:scriptNum" : "0", 135 | "rdt:startLine" : "12", 136 | "rdt:startCol" : "1", 137 | "rdt:endLine" : "12", 138 | "rdt:endCol" : "9" 139 | } , 140 | 141 | "p13" : { 142 | "rdt:name" : "micro.R", 143 | "rdt:type" : "Finish", 144 | "rdt:elapsedTime" : "1.096", 145 | "rdt:scriptNum" : "NA", 146 | "rdt:startLine" : "NA", 147 | "rdt:startCol" : "NA", 148 | "rdt:endLine" : "NA", 149 | "rdt:endCol" : "NA" 150 | } , 151 | 152 | "environment" : { 153 | "rdt:name" : "environment", 154 | "rdt:architecture" : "x86_64", 155 | "rdt:operatingSystem" : "unix", 156 | "rdt:language" : "R", 157 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 158 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 159 | "rdt:sourcedScripts" : "" 160 | , 161 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 162 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 163 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 164 | "rdt:provRVersion" : "0.1.0", 165 | "rdt:installedPackages" : [ 166 | {"package" : "base", "version" : "3.4.3"}, 167 | {"package" : "datasets", "version" : "3.4.3"}, 168 | {"package" : "devtools", "version" : "1.13.5"}, 169 | {"package" : "graphics", "version" : "3.4.3"}, 170 | {"package" : "grDevices", "version" : "3.4.3"}, 171 | {"package" : "methods", "version" : "3.4.3"}, 172 | {"package" : "provR", "version" : "0.1.0"}, 173 | {"package" : "stats", "version" : "3.4.3"}, 174 | {"package" : "utils", "version" : "3.4.3"}] 175 | } , 176 | 177 | "environment" : { 178 | "rdt:name" : "environment", 179 | "rdt:architecture" : "x86_64", 180 | "rdt:operatingSystem" : "unix", 181 | "rdt:language" : "R", 182 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 183 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 184 | "rdt:sourcedScripts" : "" 185 | , 186 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 187 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 188 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 189 | "rdt:provRVersion" : "0.1.0", 190 | "rdt:installedPackages" : [ 191 | {"package" : "base", "version" : "3.4.3"}, 192 | {"package" : "datasets", "version" : "3.4.3"}, 193 | {"package" : "devtools", "version" : "1.13.5"}, 194 | {"package" : "graphics", "version" : "3.4.3"}, 195 | {"package" : "grDevices", "version" : "3.4.3"}, 196 | {"package" : "methods", "version" : "3.4.3"}, 197 | {"package" : "provR", "version" : "0.1.0"}, 198 | {"package" : "stats", "version" : "3.4.3"}, 199 | {"package" : "utils", "version" : "3.4.3"}] 200 | } , 201 | 202 | "environment" : { 203 | "rdt:name" : "environment", 204 | "rdt:architecture" : "x86_64", 205 | "rdt:operatingSystem" : "unix", 206 | "rdt:language" : "R", 207 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 208 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 209 | "rdt:sourcedScripts" : "" 210 | , 211 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 212 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 213 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 214 | "rdt:provRVersion" : "0.1.0", 215 | "rdt:installedPackages" : [ 216 | {"package" : "base", "version" : "3.4.3"}, 217 | {"package" : "datasets", "version" : "3.4.3"}, 218 | {"package" : "devtools", "version" : "1.13.5"}, 219 | {"package" : "graphics", "version" : "3.4.3"}, 220 | {"package" : "grDevices", "version" : "3.4.3"}, 221 | {"package" : "methods", "version" : "3.4.3"}, 222 | {"package" : "provR", "version" : "0.1.0"}, 223 | {"package" : "stats", "version" : "3.4.3"}, 224 | {"package" : "utils", "version" : "3.4.3"}] 225 | } , 226 | 227 | "environment" : { 228 | "rdt:name" : "environment", 229 | "rdt:architecture" : "x86_64", 230 | "rdt:operatingSystem" : "unix", 231 | "rdt:language" : "R", 232 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 233 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 234 | "rdt:sourcedScripts" : "" 235 | , 236 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 237 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec", 238 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 239 | "rdt:provRVersion" : "0.1.0", 240 | "rdt:installedPackages" : [ 241 | {"package" : "base", "version" : "3.4.3"}, 242 | {"package" : "datasets", "version" : "3.4.3"}, 243 | {"package" : "devtools", "version" : "1.13.5"}, 244 | {"package" : "formatR", "version" : "1.5"}, 245 | {"package" : "graphics", "version" : "3.4.3"}, 246 | {"package" : "grDevices", "version" : "3.4.3"}, 247 | {"package" : "igraph", "version" : "1.1.2"}, 248 | {"package" : "methods", "version" : "3.4.3"}, 249 | {"package" : "provR", "version" : "0.1.0"}, 250 | {"package" : "stats", "version" : "3.4.3"}, 251 | {"package" : "utils", "version" : "3.4.3"}] 252 | }}, 253 | "entity":{ 254 | 255 | "d1" : { 256 | "rdt:name" : "x", 257 | "rdt:value" : "1", 258 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 259 | "rdt:type" : "Data", 260 | "rdt:scope" : "R_GlobalEnv", 261 | "rdt:fromEnv" : "FALSE", 262 | "rdt:MD5hash" : "", 263 | "rdt:timestamp" : "", 264 | "rdt:location" : "" 265 | } , 266 | 267 | "d2" : { 268 | "rdt:name" : "y", 269 | "rdt:value" : "3", 270 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 271 | "rdt:type" : "Data", 272 | "rdt:scope" : "R_GlobalEnv", 273 | "rdt:fromEnv" : "FALSE", 274 | "rdt:MD5hash" : "", 275 | "rdt:timestamp" : "", 276 | "rdt:location" : "" 277 | } , 278 | 279 | "d3" : { 280 | "rdt:name" : "x", 281 | "rdt:value" : "4", 282 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 283 | "rdt:type" : "Data", 284 | "rdt:scope" : "R_GlobalEnv", 285 | "rdt:fromEnv" : "FALSE", 286 | "rdt:MD5hash" : "", 287 | "rdt:timestamp" : "", 288 | "rdt:location" : "" 289 | } , 290 | 291 | "d4" : { 292 | "rdt:name" : "test.test", 293 | "rdt:value" : "data/4-test.test", 294 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 295 | "rdt:type" : "File", 296 | "rdt:scope" : "undefined", 297 | "rdt:fromEnv" : "FALSE", 298 | "rdt:MD5hash" : "NA", 299 | "rdt:timestamp" : "2018-03-19T12.21.18EDT", 300 | "rdt:location" : "/Users/hermes/test.test" 301 | } , 302 | 303 | "d5" : { 304 | "rdt:name" : "dev.2", 305 | "rdt:value" : "\"graph\"", 306 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 307 | "rdt:type" : "Data", 308 | "rdt:scope" : "undefined", 309 | "rdt:fromEnv" : "FALSE", 310 | "rdt:MD5hash" : "", 311 | "rdt:timestamp" : "", 312 | "rdt:location" : "" 313 | } , 314 | 315 | "d6" : { 316 | "rdt:name" : "dev.2", 317 | "rdt:value" : "\"graph\"", 318 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 319 | "rdt:type" : "Data", 320 | "rdt:scope" : "undefined", 321 | "rdt:fromEnv" : "FALSE", 322 | "rdt:MD5hash" : "", 323 | "rdt:timestamp" : "", 324 | "rdt:location" : "" 325 | } , 326 | 327 | "d7" : { 328 | "rdt:name" : "test.pdf", 329 | "rdt:value" : "data/7-test.pdf", 330 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 331 | "rdt:type" : "File", 332 | "rdt:scope" : "undefined", 333 | "rdt:fromEnv" : "FALSE", 334 | "rdt:MD5hash" : "NA", 335 | "rdt:timestamp" : "2018-03-19T12.21.18EDT", 336 | "rdt:location" : "/Users/hermes/test.pdf" 337 | }}, 338 | "wasInformedBy":{ 339 | 340 | "e1" : { 341 | "prov:informant" : "p1", 342 | "prov:informed" : "p2" 343 | } , 344 | 345 | "e3" : { 346 | "prov:informant" : "p2", 347 | "prov:informed" : "p3" 348 | } , 349 | 350 | "e5" : { 351 | "prov:informant" : "p3", 352 | "prov:informed" : "p4" 353 | } , 354 | 355 | "e6" : { 356 | "prov:informant" : "p4", 357 | "prov:informed" : "p5" 358 | } , 359 | 360 | "e8" : { 361 | "prov:informant" : "p5", 362 | "prov:informed" : "p6" 363 | } , 364 | 365 | "e12" : { 366 | "prov:informant" : "p6", 367 | "prov:informed" : "p7" 368 | } , 369 | 370 | "e14" : { 371 | "prov:informant" : "p7", 372 | "prov:informed" : "p8" 373 | } , 374 | 375 | "e16" : { 376 | "prov:informant" : "p8", 377 | "prov:informed" : "p9" 378 | } , 379 | 380 | "e19" : { 381 | "prov:informant" : "p9", 382 | "prov:informed" : "p10" 383 | } , 384 | 385 | "e21" : { 386 | "prov:informant" : "p10", 387 | "prov:informed" : "p11" 388 | } , 389 | 390 | "e25" : { 391 | "prov:informant" : "p11", 392 | "prov:informed" : "p12" 393 | } , 394 | 395 | "e28" : { 396 | "prov:informant" : "p12", 397 | "prov:informed" : "p13" 398 | }}, 399 | "wasGeneratedBy":{ 400 | 401 | "e2" : { 402 | "prov:entity" : "d1", 403 | "prov:activity" : "p2" 404 | } , 405 | 406 | "e4" : { 407 | "prov:entity" : "d2", 408 | "prov:activity" : "p3" 409 | } , 410 | 411 | "e11" : { 412 | "prov:entity" : "d3", 413 | "prov:activity" : "p6" 414 | } , 415 | 416 | "e18" : { 417 | "prov:entity" : "d4", 418 | "prov:activity" : "p9" 419 | } , 420 | 421 | "e20" : { 422 | "prov:entity" : "d5", 423 | "prov:activity" : "p10" 424 | } , 425 | 426 | "e24" : { 427 | "prov:entity" : "d6", 428 | "prov:activity" : "p11" 429 | } , 430 | 431 | "e26" : { 432 | "prov:entity" : "d7", 433 | "prov:activity" : "p12" 434 | }}, 435 | "used":{ 436 | 437 | "e7" : { 438 | "prov:activity" : "p5", 439 | "prov:entity" : "d1" 440 | } , 441 | 442 | "e9" : { 443 | "prov:activity" : "p6", 444 | "prov:entity" : "d1" 445 | } , 446 | 447 | "e10" : { 448 | "prov:activity" : "p6", 449 | "prov:entity" : "d2" 450 | } , 451 | 452 | "e13" : { 453 | "prov:activity" : "p7", 454 | "prov:entity" : "d3" 455 | } , 456 | 457 | "e15" : { 458 | "prov:activity" : "p8", 459 | "prov:entity" : "d2" 460 | } , 461 | 462 | "e17" : { 463 | "prov:activity" : "p9", 464 | "prov:entity" : "d3" 465 | } , 466 | 467 | "e22" : { 468 | "prov:activity" : "p11", 469 | "prov:entity" : "d3" 470 | } , 471 | 472 | "e23" : { 473 | "prov:activity" : "p11", 474 | "prov:entity" : "d5" 475 | } , 476 | 477 | "e27" : { 478 | "prov:activity" : "p12", 479 | "prov:entity" : "d6" 480 | }} 481 | } 482 | -------------------------------------------------------------------------------- /inst/example/prov_micro.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "prefix" : { 4 | "prov" : "http://www.w3.org/ns/prov#", 5 | "rdt" : "http://rdatatracker.org/" 6 | }, 7 | "activity":{ 8 | 9 | "p1" : { 10 | "rdt:name" : "micro.R", 11 | "rdt:type" : "Start", 12 | "rdt:elapsedTime" : "0.241", 13 | "rdt:scriptNum" : "NA", 14 | "rdt:startLine" : "NA", 15 | "rdt:startCol" : "NA", 16 | "rdt:endLine" : "NA", 17 | "rdt:endCol" : "NA" 18 | } , 19 | 20 | "p2" : { 21 | "rdt:name" : "x <- 1", 22 | "rdt:type" : "Operation", 23 | "rdt:elapsedTime" : "0.279", 24 | "rdt:scriptNum" : "0", 25 | "rdt:startLine" : "1", 26 | "rdt:startCol" : "1", 27 | "rdt:endLine" : "1", 28 | "rdt:endCol" : "5" 29 | } , 30 | 31 | "p3" : { 32 | "rdt:name" : "y <- 3", 33 | "rdt:type" : "Operation", 34 | "rdt:elapsedTime" : "0.403", 35 | "rdt:scriptNum" : "0", 36 | "rdt:startLine" : "2", 37 | "rdt:startCol" : "1", 38 | "rdt:endLine" : "2", 39 | "rdt:endCol" : "5" 40 | } , 41 | 42 | "p4" : { 43 | "rdt:name" : "10", 44 | "rdt:type" : "Operation", 45 | "rdt:elapsedTime" : "0.791", 46 | "rdt:scriptNum" : "0", 47 | "rdt:startLine" : "3", 48 | "rdt:startCol" : "1", 49 | "rdt:endLine" : "3", 50 | "rdt:endCol" : "2" 51 | } , 52 | 53 | "p5" : { 54 | "rdt:name" : "x", 55 | "rdt:type" : "Operation", 56 | "rdt:elapsedTime" : "0.793", 57 | "rdt:scriptNum" : "0", 58 | "rdt:startLine" : "4", 59 | "rdt:startCol" : "1", 60 | "rdt:endLine" : "4", 61 | "rdt:endCol" : "1" 62 | } , 63 | 64 | "p6" : { 65 | "rdt:name" : "x <- x + y", 66 | "rdt:type" : "Operation", 67 | "rdt:elapsedTime" : "0.803", 68 | "rdt:scriptNum" : "0", 69 | "rdt:startLine" : "5", 70 | "rdt:startCol" : "1", 71 | "rdt:endLine" : "5", 72 | "rdt:endCol" : "7" 73 | } , 74 | 75 | "p7" : { 76 | "rdt:name" : "x", 77 | "rdt:type" : "Operation", 78 | "rdt:elapsedTime" : "0.885", 79 | "rdt:scriptNum" : "0", 80 | "rdt:startLine" : "6", 81 | "rdt:startCol" : "1", 82 | "rdt:endLine" : "6", 83 | "rdt:endCol" : "1" 84 | } , 85 | 86 | "p8" : { 87 | "rdt:name" : "y^3", 88 | "rdt:type" : "Operation", 89 | "rdt:elapsedTime" : "0.895", 90 | "rdt:scriptNum" : "0", 91 | "rdt:startLine" : "7", 92 | "rdt:startCol" : "1", 93 | "rdt:endLine" : "7", 94 | "rdt:endCol" : "3" 95 | } , 96 | 97 | "p9" : { 98 | "rdt:name" : "write.csv(x, \"~/test.test\")", 99 | "rdt:type" : "Operation", 100 | "rdt:elapsedTime" : "0.913", 101 | "rdt:scriptNum" : "0", 102 | "rdt:startLine" : "8", 103 | "rdt:startCol" : "1", 104 | "rdt:endLine" : "8", 105 | "rdt:endCol" : "26" 106 | } , 107 | 108 | "p10" : { 109 | "rdt:name" : "pdf(\"~/test.pdf\")", 110 | "rdt:type" : "Operation", 111 | "rdt:elapsedTime" : "1.014", 112 | "rdt:scriptNum" : "0", 113 | "rdt:startLine" : "10", 114 | "rdt:startCol" : "1", 115 | "rdt:endLine" : "10", 116 | "rdt:endCol" : "17" 117 | } , 118 | 119 | "p11" : { 120 | "rdt:name" : "plot(x)", 121 | "rdt:type" : "Operation", 122 | "rdt:elapsedTime" : "1.034", 123 | "rdt:scriptNum" : "0", 124 | "rdt:startLine" : "11", 125 | "rdt:startCol" : "1", 126 | "rdt:endLine" : "11", 127 | "rdt:endCol" : "7" 128 | } , 129 | 130 | "p12" : { 131 | "rdt:name" : "dev.off()", 132 | "rdt:type" : "Operation", 133 | "rdt:elapsedTime" : "1.061", 134 | "rdt:scriptNum" : "0", 135 | "rdt:startLine" : "12", 136 | "rdt:startCol" : "1", 137 | "rdt:endLine" : "12", 138 | "rdt:endCol" : "9" 139 | } , 140 | 141 | "p13" : { 142 | "rdt:name" : "micro.R", 143 | "rdt:type" : "Finish", 144 | "rdt:elapsedTime" : "1.096", 145 | "rdt:scriptNum" : "NA", 146 | "rdt:startLine" : "NA", 147 | "rdt:startCol" : "NA", 148 | "rdt:endLine" : "NA", 149 | "rdt:endCol" : "NA" 150 | } , 151 | 152 | "environment" : { 153 | "rdt:name" : "environment", 154 | "rdt:architecture" : "x86_64", 155 | "rdt:operatingSystem" : "unix", 156 | "rdt:language" : "R", 157 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 158 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 159 | "rdt:sourcedScripts" : "" 160 | , 161 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 162 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 163 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 164 | "rdt:provRVersion" : "0.1.0", 165 | "rdt:installedPackages" : [ 166 | {"package" : "base", "version" : "3.4.3"}, 167 | {"package" : "datasets", "version" : "3.4.3"}, 168 | {"package" : "devtools", "version" : "1.13.5"}, 169 | {"package" : "graphics", "version" : "3.4.3"}, 170 | {"package" : "grDevices", "version" : "3.4.3"}, 171 | {"package" : "methods", "version" : "3.4.3"}, 172 | {"package" : "provR", "version" : "0.1.0"}, 173 | {"package" : "stats", "version" : "3.4.3"}, 174 | {"package" : "utils", "version" : "3.4.3"}] 175 | } , 176 | 177 | "environment" : { 178 | "rdt:name" : "environment", 179 | "rdt:architecture" : "x86_64", 180 | "rdt:operatingSystem" : "unix", 181 | "rdt:language" : "R", 182 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 183 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 184 | "rdt:sourcedScripts" : "" 185 | , 186 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 187 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 188 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 189 | "rdt:provRVersion" : "0.1.0", 190 | "rdt:installedPackages" : [ 191 | {"package" : "base", "version" : "3.4.3"}, 192 | {"package" : "datasets", "version" : "3.4.3"}, 193 | {"package" : "devtools", "version" : "1.13.5"}, 194 | {"package" : "graphics", "version" : "3.4.3"}, 195 | {"package" : "grDevices", "version" : "3.4.3"}, 196 | {"package" : "methods", "version" : "3.4.3"}, 197 | {"package" : "provR", "version" : "0.1.0"}, 198 | {"package" : "stats", "version" : "3.4.3"}, 199 | {"package" : "utils", "version" : "3.4.3"}] 200 | } , 201 | 202 | "environment" : { 203 | "rdt:name" : "environment", 204 | "rdt:architecture" : "x86_64", 205 | "rdt:operatingSystem" : "unix", 206 | "rdt:language" : "R", 207 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 208 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 209 | "rdt:sourcedScripts" : "" 210 | , 211 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 212 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 213 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 214 | "rdt:provRVersion" : "0.1.0", 215 | "rdt:installedPackages" : [ 216 | {"package" : "base", "version" : "3.4.3"}, 217 | {"package" : "datasets", "version" : "3.4.3"}, 218 | {"package" : "devtools", "version" : "1.13.5"}, 219 | {"package" : "graphics", "version" : "3.4.3"}, 220 | {"package" : "grDevices", "version" : "3.4.3"}, 221 | {"package" : "methods", "version" : "3.4.3"}, 222 | {"package" : "provR", "version" : "0.1.0"}, 223 | {"package" : "stats", "version" : "3.4.3"}, 224 | {"package" : "utils", "version" : "3.4.3"}] 225 | } , 226 | 227 | "environment" : { 228 | "rdt:name" : "environment", 229 | "rdt:architecture" : "x86_64", 230 | "rdt:operatingSystem" : "unix", 231 | "rdt:language" : "R", 232 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 233 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 234 | "rdt:sourcedScripts" : "" 235 | , 236 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 237 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec", 238 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 239 | "rdt:provRVersion" : "0.1.0", 240 | "rdt:installedPackages" : [ 241 | {"package" : "base", "version" : "3.4.3"}, 242 | {"package" : "datasets", "version" : "3.4.3"}, 243 | {"package" : "devtools", "version" : "1.13.5"}, 244 | {"package" : "formatR", "version" : "1.5"}, 245 | {"package" : "graphics", "version" : "3.4.3"}, 246 | {"package" : "grDevices", "version" : "3.4.3"}, 247 | {"package" : "igraph", "version" : "1.1.2"}, 248 | {"package" : "methods", "version" : "3.4.3"}, 249 | {"package" : "provR", "version" : "0.1.0"}, 250 | {"package" : "stats", "version" : "3.4.3"}, 251 | {"package" : "utils", "version" : "3.4.3"}] 252 | }}, 253 | "entity":{ 254 | 255 | "d1" : { 256 | "rdt:name" : "x", 257 | "rdt:value" : "1", 258 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 259 | "rdt:type" : "Data", 260 | "rdt:scope" : "R_GlobalEnv", 261 | "rdt:fromEnv" : "FALSE", 262 | "rdt:MD5hash" : "", 263 | "rdt:timestamp" : "", 264 | "rdt:location" : "" 265 | } , 266 | 267 | "d2" : { 268 | "rdt:name" : "y", 269 | "rdt:value" : "3", 270 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 271 | "rdt:type" : "Data", 272 | "rdt:scope" : "R_GlobalEnv", 273 | "rdt:fromEnv" : "FALSE", 274 | "rdt:MD5hash" : "", 275 | "rdt:timestamp" : "", 276 | "rdt:location" : "" 277 | } , 278 | 279 | "d3" : { 280 | "rdt:name" : "x", 281 | "rdt:value" : "4", 282 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 283 | "rdt:type" : "Data", 284 | "rdt:scope" : "R_GlobalEnv", 285 | "rdt:fromEnv" : "FALSE", 286 | "rdt:MD5hash" : "", 287 | "rdt:timestamp" : "", 288 | "rdt:location" : "" 289 | } , 290 | 291 | "d4" : { 292 | "rdt:name" : "test.test", 293 | "rdt:value" : "data/4-test.test", 294 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 295 | "rdt:type" : "File", 296 | "rdt:scope" : "undefined", 297 | "rdt:fromEnv" : "FALSE", 298 | "rdt:MD5hash" : "NA", 299 | "rdt:timestamp" : "2018-03-19T12.21.18EDT", 300 | "rdt:location" : "/Users/hermes/test.test" 301 | } , 302 | 303 | "d5" : { 304 | "rdt:name" : "dev.2", 305 | "rdt:value" : "\"graph\"", 306 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 307 | "rdt:type" : "Data", 308 | "rdt:scope" : "undefined", 309 | "rdt:fromEnv" : "FALSE", 310 | "rdt:MD5hash" : "", 311 | "rdt:timestamp" : "", 312 | "rdt:location" : "" 313 | } , 314 | 315 | "d6" : { 316 | "rdt:name" : "dev.2", 317 | "rdt:value" : "\"graph\"", 318 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 319 | "rdt:type" : "Data", 320 | "rdt:scope" : "undefined", 321 | "rdt:fromEnv" : "FALSE", 322 | "rdt:MD5hash" : "", 323 | "rdt:timestamp" : "", 324 | "rdt:location" : "" 325 | } , 326 | 327 | "d7" : { 328 | "rdt:name" : "test.pdf", 329 | "rdt:value" : "data/7-test.pdf", 330 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 331 | "rdt:type" : "File", 332 | "rdt:scope" : "undefined", 333 | "rdt:fromEnv" : "FALSE", 334 | "rdt:MD5hash" : "NA", 335 | "rdt:timestamp" : "2018-03-19T12.21.18EDT", 336 | "rdt:location" : "/Users/hermes/test.pdf" 337 | }}, 338 | "wasInformedBy":{ 339 | 340 | "e1" : { 341 | "prov:informant" : "p1", 342 | "prov:informed" : "p2" 343 | } , 344 | 345 | "e3" : { 346 | "prov:informant" : "p2", 347 | "prov:informed" : "p3" 348 | } , 349 | 350 | "e5" : { 351 | "prov:informant" : "p3", 352 | "prov:informed" : "p4" 353 | } , 354 | 355 | "e6" : { 356 | "prov:informant" : "p4", 357 | "prov:informed" : "p5" 358 | } , 359 | 360 | "e8" : { 361 | "prov:informant" : "p5", 362 | "prov:informed" : "p6" 363 | } , 364 | 365 | "e12" : { 366 | "prov:informant" : "p6", 367 | "prov:informed" : "p7" 368 | } , 369 | 370 | "e14" : { 371 | "prov:informant" : "p7", 372 | "prov:informed" : "p8" 373 | } , 374 | 375 | "e16" : { 376 | "prov:informant" : "p8", 377 | "prov:informed" : "p9" 378 | } , 379 | 380 | "e19" : { 381 | "prov:informant" : "p9", 382 | "prov:informed" : "p10" 383 | } , 384 | 385 | "e21" : { 386 | "prov:informant" : "p10", 387 | "prov:informed" : "p11" 388 | } , 389 | 390 | "e25" : { 391 | "prov:informant" : "p11", 392 | "prov:informed" : "p12" 393 | } , 394 | 395 | "e28" : { 396 | "prov:informant" : "p12", 397 | "prov:informed" : "p13" 398 | }}, 399 | "wasGeneratedBy":{ 400 | 401 | "e2" : { 402 | "prov:entity" : "d1", 403 | "prov:activity" : "p2" 404 | } , 405 | 406 | "e4" : { 407 | "prov:entity" : "d2", 408 | "prov:activity" : "p3" 409 | } , 410 | 411 | "e11" : { 412 | "prov:entity" : "d3", 413 | "prov:activity" : "p6" 414 | } , 415 | 416 | "e18" : { 417 | "prov:entity" : "d4", 418 | "prov:activity" : "p9" 419 | } , 420 | 421 | "e20" : { 422 | "prov:entity" : "d5", 423 | "prov:activity" : "p10" 424 | } , 425 | 426 | "e24" : { 427 | "prov:entity" : "d6", 428 | "prov:activity" : "p11" 429 | } , 430 | 431 | "e26" : { 432 | "prov:entity" : "d7", 433 | "prov:activity" : "p12" 434 | }}, 435 | "used":{ 436 | 437 | "e7" : { 438 | "prov:activity" : "p5", 439 | "prov:entity" : "d1" 440 | } , 441 | 442 | "e9" : { 443 | "prov:activity" : "p6", 444 | "prov:entity" : "d1" 445 | } , 446 | 447 | "e10" : { 448 | "prov:activity" : "p6", 449 | "prov:entity" : "d2" 450 | } , 451 | 452 | "e13" : { 453 | "prov:activity" : "p7", 454 | "prov:entity" : "d3" 455 | } , 456 | 457 | "e15" : { 458 | "prov:activity" : "p8", 459 | "prov:entity" : "d2" 460 | } , 461 | 462 | "e17" : { 463 | "prov:activity" : "p9", 464 | "prov:entity" : "d3" 465 | } , 466 | 467 | "e22" : { 468 | "prov:activity" : "p11", 469 | "prov:entity" : "d3" 470 | } , 471 | 472 | "e23" : { 473 | "prov:activity" : "p11", 474 | "prov:entity" : "d5" 475 | } , 476 | 477 | "e27" : { 478 | "prov:activity" : "p12", 479 | "prov:entity" : "d6" 480 | }} 481 | } 482 | -------------------------------------------------------------------------------- /tests/testthat/micro_R.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "prefix" : { 4 | "prov" : "http://www.w3.org/ns/prov#", 5 | "rdt" : "http://rdatatracker.org/" 6 | }, 7 | "activity":{ 8 | 9 | "p1" : { 10 | "rdt:name" : "micro.R", 11 | "rdt:type" : "Start", 12 | "rdt:elapsedTime" : "0.241", 13 | "rdt:scriptNum" : "NA", 14 | "rdt:startLine" : "NA", 15 | "rdt:startCol" : "NA", 16 | "rdt:endLine" : "NA", 17 | "rdt:endCol" : "NA" 18 | } , 19 | 20 | "p2" : { 21 | "rdt:name" : "x <- 1", 22 | "rdt:type" : "Operation", 23 | "rdt:elapsedTime" : "0.279", 24 | "rdt:scriptNum" : "0", 25 | "rdt:startLine" : "1", 26 | "rdt:startCol" : "1", 27 | "rdt:endLine" : "1", 28 | "rdt:endCol" : "5" 29 | } , 30 | 31 | "p3" : { 32 | "rdt:name" : "y <- 3", 33 | "rdt:type" : "Operation", 34 | "rdt:elapsedTime" : "0.403", 35 | "rdt:scriptNum" : "0", 36 | "rdt:startLine" : "2", 37 | "rdt:startCol" : "1", 38 | "rdt:endLine" : "2", 39 | "rdt:endCol" : "5" 40 | } , 41 | 42 | "p4" : { 43 | "rdt:name" : "10", 44 | "rdt:type" : "Operation", 45 | "rdt:elapsedTime" : "0.791", 46 | "rdt:scriptNum" : "0", 47 | "rdt:startLine" : "3", 48 | "rdt:startCol" : "1", 49 | "rdt:endLine" : "3", 50 | "rdt:endCol" : "2" 51 | } , 52 | 53 | "p5" : { 54 | "rdt:name" : "x", 55 | "rdt:type" : "Operation", 56 | "rdt:elapsedTime" : "0.793", 57 | "rdt:scriptNum" : "0", 58 | "rdt:startLine" : "4", 59 | "rdt:startCol" : "1", 60 | "rdt:endLine" : "4", 61 | "rdt:endCol" : "1" 62 | } , 63 | 64 | "p6" : { 65 | "rdt:name" : "x <- x + y", 66 | "rdt:type" : "Operation", 67 | "rdt:elapsedTime" : "0.803", 68 | "rdt:scriptNum" : "0", 69 | "rdt:startLine" : "5", 70 | "rdt:startCol" : "1", 71 | "rdt:endLine" : "5", 72 | "rdt:endCol" : "7" 73 | } , 74 | 75 | "p7" : { 76 | "rdt:name" : "x", 77 | "rdt:type" : "Operation", 78 | "rdt:elapsedTime" : "0.885", 79 | "rdt:scriptNum" : "0", 80 | "rdt:startLine" : "6", 81 | "rdt:startCol" : "1", 82 | "rdt:endLine" : "6", 83 | "rdt:endCol" : "1" 84 | } , 85 | 86 | "p8" : { 87 | "rdt:name" : "y^3", 88 | "rdt:type" : "Operation", 89 | "rdt:elapsedTime" : "0.895", 90 | "rdt:scriptNum" : "0", 91 | "rdt:startLine" : "7", 92 | "rdt:startCol" : "1", 93 | "rdt:endLine" : "7", 94 | "rdt:endCol" : "3" 95 | } , 96 | 97 | "p9" : { 98 | "rdt:name" : "write.csv(x, \"~/test.test\")", 99 | "rdt:type" : "Operation", 100 | "rdt:elapsedTime" : "0.913", 101 | "rdt:scriptNum" : "0", 102 | "rdt:startLine" : "8", 103 | "rdt:startCol" : "1", 104 | "rdt:endLine" : "8", 105 | "rdt:endCol" : "26" 106 | } , 107 | 108 | "p10" : { 109 | "rdt:name" : "pdf(\"~/test.pdf\")", 110 | "rdt:type" : "Operation", 111 | "rdt:elapsedTime" : "1.014", 112 | "rdt:scriptNum" : "0", 113 | "rdt:startLine" : "10", 114 | "rdt:startCol" : "1", 115 | "rdt:endLine" : "10", 116 | "rdt:endCol" : "17" 117 | } , 118 | 119 | "p11" : { 120 | "rdt:name" : "plot(x)", 121 | "rdt:type" : "Operation", 122 | "rdt:elapsedTime" : "1.034", 123 | "rdt:scriptNum" : "0", 124 | "rdt:startLine" : "11", 125 | "rdt:startCol" : "1", 126 | "rdt:endLine" : "11", 127 | "rdt:endCol" : "7" 128 | } , 129 | 130 | "p12" : { 131 | "rdt:name" : "dev.off()", 132 | "rdt:type" : "Operation", 133 | "rdt:elapsedTime" : "1.061", 134 | "rdt:scriptNum" : "0", 135 | "rdt:startLine" : "12", 136 | "rdt:startCol" : "1", 137 | "rdt:endLine" : "12", 138 | "rdt:endCol" : "9" 139 | } , 140 | 141 | "p13" : { 142 | "rdt:name" : "micro.R", 143 | "rdt:type" : "Finish", 144 | "rdt:elapsedTime" : "1.096", 145 | "rdt:scriptNum" : "NA", 146 | "rdt:startLine" : "NA", 147 | "rdt:startCol" : "NA", 148 | "rdt:endLine" : "NA", 149 | "rdt:endCol" : "NA" 150 | } , 151 | 152 | "environment" : { 153 | "rdt:name" : "environment", 154 | "rdt:architecture" : "x86_64", 155 | "rdt:operatingSystem" : "unix", 156 | "rdt:language" : "R", 157 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 158 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 159 | "rdt:sourcedScripts" : "" 160 | , 161 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 162 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 163 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 164 | "rdt:provRVersion" : "0.1.0", 165 | "rdt:installedPackages" : [ 166 | {"package" : "base", "version" : "3.4.3"}, 167 | {"package" : "datasets", "version" : "3.4.3"}, 168 | {"package" : "devtools", "version" : "1.13.5"}, 169 | {"package" : "graphics", "version" : "3.4.3"}, 170 | {"package" : "grDevices", "version" : "3.4.3"}, 171 | {"package" : "methods", "version" : "3.4.3"}, 172 | {"package" : "provR", "version" : "0.1.0"}, 173 | {"package" : "stats", "version" : "3.4.3"}, 174 | {"package" : "utils", "version" : "3.4.3"}] 175 | } , 176 | 177 | "environment" : { 178 | "rdt:name" : "environment", 179 | "rdt:architecture" : "x86_64", 180 | "rdt:operatingSystem" : "unix", 181 | "rdt:language" : "R", 182 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 183 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 184 | "rdt:sourcedScripts" : "" 185 | , 186 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 187 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 188 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 189 | "rdt:provRVersion" : "0.1.0", 190 | "rdt:installedPackages" : [ 191 | {"package" : "base", "version" : "3.4.3"}, 192 | {"package" : "datasets", "version" : "3.4.3"}, 193 | {"package" : "devtools", "version" : "1.13.5"}, 194 | {"package" : "graphics", "version" : "3.4.3"}, 195 | {"package" : "grDevices", "version" : "3.4.3"}, 196 | {"package" : "methods", "version" : "3.4.3"}, 197 | {"package" : "provR", "version" : "0.1.0"}, 198 | {"package" : "stats", "version" : "3.4.3"}, 199 | {"package" : "utils", "version" : "3.4.3"}] 200 | } , 201 | 202 | "environment" : { 203 | "rdt:name" : "environment", 204 | "rdt:architecture" : "x86_64", 205 | "rdt:operatingSystem" : "unix", 206 | "rdt:language" : "R", 207 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 208 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 209 | "rdt:sourcedScripts" : "" 210 | , 211 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 212 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 213 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 214 | "rdt:provRVersion" : "0.1.0", 215 | "rdt:installedPackages" : [ 216 | {"package" : "base", "version" : "3.4.3"}, 217 | {"package" : "datasets", "version" : "3.4.3"}, 218 | {"package" : "devtools", "version" : "1.13.5"}, 219 | {"package" : "graphics", "version" : "3.4.3"}, 220 | {"package" : "grDevices", "version" : "3.4.3"}, 221 | {"package" : "methods", "version" : "3.4.3"}, 222 | {"package" : "provR", "version" : "0.1.0"}, 223 | {"package" : "stats", "version" : "3.4.3"}, 224 | {"package" : "utils", "version" : "3.4.3"}] 225 | } , 226 | 227 | "environment" : { 228 | "rdt:name" : "environment", 229 | "rdt:architecture" : "x86_64", 230 | "rdt:operatingSystem" : "unix", 231 | "rdt:language" : "R", 232 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 233 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 234 | "rdt:sourcedScripts" : "" 235 | , 236 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 237 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec", 238 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 239 | "rdt:provRVersion" : "0.1.0", 240 | "rdt:installedPackages" : [ 241 | {"package" : "base", "version" : "3.4.3"}, 242 | {"package" : "datasets", "version" : "3.4.3"}, 243 | {"package" : "devtools", "version" : "1.13.5"}, 244 | {"package" : "formatR", "version" : "1.5"}, 245 | {"package" : "graphics", "version" : "3.4.3"}, 246 | {"package" : "grDevices", "version" : "3.4.3"}, 247 | {"package" : "igraph", "version" : "1.1.2"}, 248 | {"package" : "methods", "version" : "3.4.3"}, 249 | {"package" : "provR", "version" : "0.1.0"}, 250 | {"package" : "stats", "version" : "3.4.3"}, 251 | {"package" : "utils", "version" : "3.4.3"}] 252 | }}, 253 | "entity":{ 254 | 255 | "d1" : { 256 | "rdt:name" : "x", 257 | "rdt:value" : "1", 258 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 259 | "rdt:type" : "Data", 260 | "rdt:scope" : "R_GlobalEnv", 261 | "rdt:fromEnv" : "FALSE", 262 | "rdt:MD5hash" : "", 263 | "rdt:timestamp" : "", 264 | "rdt:location" : "" 265 | } , 266 | 267 | "d2" : { 268 | "rdt:name" : "y", 269 | "rdt:value" : "3", 270 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 271 | "rdt:type" : "Data", 272 | "rdt:scope" : "R_GlobalEnv", 273 | "rdt:fromEnv" : "FALSE", 274 | "rdt:MD5hash" : "", 275 | "rdt:timestamp" : "", 276 | "rdt:location" : "" 277 | } , 278 | 279 | "d3" : { 280 | "rdt:name" : "x", 281 | "rdt:value" : "4", 282 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 283 | "rdt:type" : "Data", 284 | "rdt:scope" : "R_GlobalEnv", 285 | "rdt:fromEnv" : "FALSE", 286 | "rdt:MD5hash" : "", 287 | "rdt:timestamp" : "", 288 | "rdt:location" : "" 289 | } , 290 | 291 | "d4" : { 292 | "rdt:name" : "test.test", 293 | "rdt:value" : "data/4-test.test", 294 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 295 | "rdt:type" : "File", 296 | "rdt:scope" : "undefined", 297 | "rdt:fromEnv" : "FALSE", 298 | "rdt:MD5hash" : "NA", 299 | "rdt:timestamp" : "2018-03-19T12.21.18EDT", 300 | "rdt:location" : "/Users/hermes/test.test" 301 | } , 302 | 303 | "d5" : { 304 | "rdt:name" : "dev.2", 305 | "rdt:value" : "\"graph\"", 306 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 307 | "rdt:type" : "Data", 308 | "rdt:scope" : "undefined", 309 | "rdt:fromEnv" : "FALSE", 310 | "rdt:MD5hash" : "", 311 | "rdt:timestamp" : "", 312 | "rdt:location" : "" 313 | } , 314 | 315 | "d6" : { 316 | "rdt:name" : "dev.2", 317 | "rdt:value" : "\"graph\"", 318 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 319 | "rdt:type" : "Data", 320 | "rdt:scope" : "undefined", 321 | "rdt:fromEnv" : "FALSE", 322 | "rdt:MD5hash" : "", 323 | "rdt:timestamp" : "", 324 | "rdt:location" : "" 325 | } , 326 | 327 | "d7" : { 328 | "rdt:name" : "test.pdf", 329 | "rdt:value" : "data/7-test.pdf", 330 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 331 | "rdt:type" : "File", 332 | "rdt:scope" : "undefined", 333 | "rdt:fromEnv" : "FALSE", 334 | "rdt:MD5hash" : "NA", 335 | "rdt:timestamp" : "2018-03-19T12.21.18EDT", 336 | "rdt:location" : "/Users/hermes/test.pdf" 337 | }}, 338 | "wasInformedBy":{ 339 | 340 | "e1" : { 341 | "prov:informant" : "p1", 342 | "prov:informed" : "p2" 343 | } , 344 | 345 | "e3" : { 346 | "prov:informant" : "p2", 347 | "prov:informed" : "p3" 348 | } , 349 | 350 | "e5" : { 351 | "prov:informant" : "p3", 352 | "prov:informed" : "p4" 353 | } , 354 | 355 | "e6" : { 356 | "prov:informant" : "p4", 357 | "prov:informed" : "p5" 358 | } , 359 | 360 | "e8" : { 361 | "prov:informant" : "p5", 362 | "prov:informed" : "p6" 363 | } , 364 | 365 | "e12" : { 366 | "prov:informant" : "p6", 367 | "prov:informed" : "p7" 368 | } , 369 | 370 | "e14" : { 371 | "prov:informant" : "p7", 372 | "prov:informed" : "p8" 373 | } , 374 | 375 | "e16" : { 376 | "prov:informant" : "p8", 377 | "prov:informed" : "p9" 378 | } , 379 | 380 | "e19" : { 381 | "prov:informant" : "p9", 382 | "prov:informed" : "p10" 383 | } , 384 | 385 | "e21" : { 386 | "prov:informant" : "p10", 387 | "prov:informed" : "p11" 388 | } , 389 | 390 | "e25" : { 391 | "prov:informant" : "p11", 392 | "prov:informed" : "p12" 393 | } , 394 | 395 | "e28" : { 396 | "prov:informant" : "p12", 397 | "prov:informed" : "p13" 398 | }}, 399 | "wasGeneratedBy":{ 400 | 401 | "e2" : { 402 | "prov:entity" : "d1", 403 | "prov:activity" : "p2" 404 | } , 405 | 406 | "e4" : { 407 | "prov:entity" : "d2", 408 | "prov:activity" : "p3" 409 | } , 410 | 411 | "e11" : { 412 | "prov:entity" : "d3", 413 | "prov:activity" : "p6" 414 | } , 415 | 416 | "e18" : { 417 | "prov:entity" : "d4", 418 | "prov:activity" : "p9" 419 | } , 420 | 421 | "e20" : { 422 | "prov:entity" : "d5", 423 | "prov:activity" : "p10" 424 | } , 425 | 426 | "e24" : { 427 | "prov:entity" : "d6", 428 | "prov:activity" : "p11" 429 | } , 430 | 431 | "e26" : { 432 | "prov:entity" : "d7", 433 | "prov:activity" : "p12" 434 | }}, 435 | "used":{ 436 | 437 | "e7" : { 438 | "prov:activity" : "p5", 439 | "prov:entity" : "d1" 440 | } , 441 | 442 | "e9" : { 443 | "prov:activity" : "p6", 444 | "prov:entity" : "d1" 445 | } , 446 | 447 | "e10" : { 448 | "prov:activity" : "p6", 449 | "prov:entity" : "d2" 450 | } , 451 | 452 | "e13" : { 453 | "prov:activity" : "p7", 454 | "prov:entity" : "d3" 455 | } , 456 | 457 | "e15" : { 458 | "prov:activity" : "p8", 459 | "prov:entity" : "d2" 460 | } , 461 | 462 | "e17" : { 463 | "prov:activity" : "p9", 464 | "prov:entity" : "d3" 465 | } , 466 | 467 | "e22" : { 468 | "prov:activity" : "p11", 469 | "prov:entity" : "d3" 470 | } , 471 | 472 | "e23" : { 473 | "prov:activity" : "p11", 474 | "prov:entity" : "d5" 475 | } , 476 | 477 | "e27" : { 478 | "prov:activity" : "p12", 479 | "prov:entity" : "d6" 480 | }} 481 | } 482 | -------------------------------------------------------------------------------- /vignettes/example/prov_micro.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "prefix" : { 4 | "prov" : "http://www.w3.org/ns/prov#", 5 | "rdt" : "http://rdatatracker.org/" 6 | }, 7 | "activity":{ 8 | 9 | "p1" : { 10 | "rdt:name" : "micro.R", 11 | "rdt:type" : "Start", 12 | "rdt:elapsedTime" : "0.241", 13 | "rdt:scriptNum" : "NA", 14 | "rdt:startLine" : "NA", 15 | "rdt:startCol" : "NA", 16 | "rdt:endLine" : "NA", 17 | "rdt:endCol" : "NA" 18 | } , 19 | 20 | "p2" : { 21 | "rdt:name" : "x <- 1", 22 | "rdt:type" : "Operation", 23 | "rdt:elapsedTime" : "0.279", 24 | "rdt:scriptNum" : "0", 25 | "rdt:startLine" : "1", 26 | "rdt:startCol" : "1", 27 | "rdt:endLine" : "1", 28 | "rdt:endCol" : "5" 29 | } , 30 | 31 | "p3" : { 32 | "rdt:name" : "y <- 3", 33 | "rdt:type" : "Operation", 34 | "rdt:elapsedTime" : "0.403", 35 | "rdt:scriptNum" : "0", 36 | "rdt:startLine" : "2", 37 | "rdt:startCol" : "1", 38 | "rdt:endLine" : "2", 39 | "rdt:endCol" : "5" 40 | } , 41 | 42 | "p4" : { 43 | "rdt:name" : "10", 44 | "rdt:type" : "Operation", 45 | "rdt:elapsedTime" : "0.791", 46 | "rdt:scriptNum" : "0", 47 | "rdt:startLine" : "3", 48 | "rdt:startCol" : "1", 49 | "rdt:endLine" : "3", 50 | "rdt:endCol" : "2" 51 | } , 52 | 53 | "p5" : { 54 | "rdt:name" : "x", 55 | "rdt:type" : "Operation", 56 | "rdt:elapsedTime" : "0.793", 57 | "rdt:scriptNum" : "0", 58 | "rdt:startLine" : "4", 59 | "rdt:startCol" : "1", 60 | "rdt:endLine" : "4", 61 | "rdt:endCol" : "1" 62 | } , 63 | 64 | "p6" : { 65 | "rdt:name" : "x <- x + y", 66 | "rdt:type" : "Operation", 67 | "rdt:elapsedTime" : "0.803", 68 | "rdt:scriptNum" : "0", 69 | "rdt:startLine" : "5", 70 | "rdt:startCol" : "1", 71 | "rdt:endLine" : "5", 72 | "rdt:endCol" : "7" 73 | } , 74 | 75 | "p7" : { 76 | "rdt:name" : "x", 77 | "rdt:type" : "Operation", 78 | "rdt:elapsedTime" : "0.885", 79 | "rdt:scriptNum" : "0", 80 | "rdt:startLine" : "6", 81 | "rdt:startCol" : "1", 82 | "rdt:endLine" : "6", 83 | "rdt:endCol" : "1" 84 | } , 85 | 86 | "p8" : { 87 | "rdt:name" : "y^3", 88 | "rdt:type" : "Operation", 89 | "rdt:elapsedTime" : "0.895", 90 | "rdt:scriptNum" : "0", 91 | "rdt:startLine" : "7", 92 | "rdt:startCol" : "1", 93 | "rdt:endLine" : "7", 94 | "rdt:endCol" : "3" 95 | } , 96 | 97 | "p9" : { 98 | "rdt:name" : "write.csv(x, \"~/test.test\")", 99 | "rdt:type" : "Operation", 100 | "rdt:elapsedTime" : "0.913", 101 | "rdt:scriptNum" : "0", 102 | "rdt:startLine" : "8", 103 | "rdt:startCol" : "1", 104 | "rdt:endLine" : "8", 105 | "rdt:endCol" : "26" 106 | } , 107 | 108 | "p10" : { 109 | "rdt:name" : "pdf(\"~/test.pdf\")", 110 | "rdt:type" : "Operation", 111 | "rdt:elapsedTime" : "1.014", 112 | "rdt:scriptNum" : "0", 113 | "rdt:startLine" : "10", 114 | "rdt:startCol" : "1", 115 | "rdt:endLine" : "10", 116 | "rdt:endCol" : "17" 117 | } , 118 | 119 | "p11" : { 120 | "rdt:name" : "plot(x)", 121 | "rdt:type" : "Operation", 122 | "rdt:elapsedTime" : "1.034", 123 | "rdt:scriptNum" : "0", 124 | "rdt:startLine" : "11", 125 | "rdt:startCol" : "1", 126 | "rdt:endLine" : "11", 127 | "rdt:endCol" : "7" 128 | } , 129 | 130 | "p12" : { 131 | "rdt:name" : "dev.off()", 132 | "rdt:type" : "Operation", 133 | "rdt:elapsedTime" : "1.061", 134 | "rdt:scriptNum" : "0", 135 | "rdt:startLine" : "12", 136 | "rdt:startCol" : "1", 137 | "rdt:endLine" : "12", 138 | "rdt:endCol" : "9" 139 | } , 140 | 141 | "p13" : { 142 | "rdt:name" : "micro.R", 143 | "rdt:type" : "Finish", 144 | "rdt:elapsedTime" : "1.096", 145 | "rdt:scriptNum" : "NA", 146 | "rdt:startLine" : "NA", 147 | "rdt:startCol" : "NA", 148 | "rdt:endLine" : "NA", 149 | "rdt:endCol" : "NA" 150 | } , 151 | 152 | "environment" : { 153 | "rdt:name" : "environment", 154 | "rdt:architecture" : "x86_64", 155 | "rdt:operatingSystem" : "unix", 156 | "rdt:language" : "R", 157 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 158 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 159 | "rdt:sourcedScripts" : "" 160 | , 161 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 162 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 163 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 164 | "rdt:provRVersion" : "0.1.0", 165 | "rdt:installedPackages" : [ 166 | {"package" : "base", "version" : "3.4.3"}, 167 | {"package" : "datasets", "version" : "3.4.3"}, 168 | {"package" : "devtools", "version" : "1.13.5"}, 169 | {"package" : "graphics", "version" : "3.4.3"}, 170 | {"package" : "grDevices", "version" : "3.4.3"}, 171 | {"package" : "methods", "version" : "3.4.3"}, 172 | {"package" : "provR", "version" : "0.1.0"}, 173 | {"package" : "stats", "version" : "3.4.3"}, 174 | {"package" : "utils", "version" : "3.4.3"}] 175 | } , 176 | 177 | "environment" : { 178 | "rdt:name" : "environment", 179 | "rdt:architecture" : "x86_64", 180 | "rdt:operatingSystem" : "unix", 181 | "rdt:language" : "R", 182 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 183 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 184 | "rdt:sourcedScripts" : "" 185 | , 186 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 187 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 188 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 189 | "rdt:provRVersion" : "0.1.0", 190 | "rdt:installedPackages" : [ 191 | {"package" : "base", "version" : "3.4.3"}, 192 | {"package" : "datasets", "version" : "3.4.3"}, 193 | {"package" : "devtools", "version" : "1.13.5"}, 194 | {"package" : "graphics", "version" : "3.4.3"}, 195 | {"package" : "grDevices", "version" : "3.4.3"}, 196 | {"package" : "methods", "version" : "3.4.3"}, 197 | {"package" : "provR", "version" : "0.1.0"}, 198 | {"package" : "stats", "version" : "3.4.3"}, 199 | {"package" : "utils", "version" : "3.4.3"}] 200 | } , 201 | 202 | "environment" : { 203 | "rdt:name" : "environment", 204 | "rdt:architecture" : "x86_64", 205 | "rdt:operatingSystem" : "unix", 206 | "rdt:language" : "R", 207 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 208 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 209 | "rdt:sourcedScripts" : "" 210 | , 211 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 212 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/R", 213 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 214 | "rdt:provRVersion" : "0.1.0", 215 | "rdt:installedPackages" : [ 216 | {"package" : "base", "version" : "3.4.3"}, 217 | {"package" : "datasets", "version" : "3.4.3"}, 218 | {"package" : "devtools", "version" : "1.13.5"}, 219 | {"package" : "graphics", "version" : "3.4.3"}, 220 | {"package" : "grDevices", "version" : "3.4.3"}, 221 | {"package" : "methods", "version" : "3.4.3"}, 222 | {"package" : "provR", "version" : "0.1.0"}, 223 | {"package" : "stats", "version" : "3.4.3"}, 224 | {"package" : "utils", "version" : "3.4.3"}] 225 | } , 226 | 227 | "environment" : { 228 | "rdt:name" : "environment", 229 | "rdt:architecture" : "x86_64", 230 | "rdt:operatingSystem" : "unix", 231 | "rdt:language" : "R", 232 | "rdt:rVersion" : "R version 3.4.3 (2017-11-30)", 233 | "rdt:script" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec/micro.R", 234 | "rdt:sourcedScripts" : "" 235 | , 236 | "rdt:scriptTimeStamp" : "2018-03-19T11.51.17EDT", 237 | "rdt:workingDirectory" : "/Users/hermes/Labs/HF/projects/e2ep/projects/cleanR/exec", 238 | "rdt:ddgTimeStamp" : "2018-03-19T12.21.17EDT", 239 | "rdt:provRVersion" : "0.1.0", 240 | "rdt:installedPackages" : [ 241 | {"package" : "base", "version" : "3.4.3"}, 242 | {"package" : "datasets", "version" : "3.4.3"}, 243 | {"package" : "devtools", "version" : "1.13.5"}, 244 | {"package" : "formatR", "version" : "1.5"}, 245 | {"package" : "graphics", "version" : "3.4.3"}, 246 | {"package" : "grDevices", "version" : "3.4.3"}, 247 | {"package" : "igraph", "version" : "1.1.2"}, 248 | {"package" : "methods", "version" : "3.4.3"}, 249 | {"package" : "provR", "version" : "0.1.0"}, 250 | {"package" : "stats", "version" : "3.4.3"}, 251 | {"package" : "utils", "version" : "3.4.3"}] 252 | }}, 253 | "entity":{ 254 | 255 | "d1" : { 256 | "rdt:name" : "x", 257 | "rdt:value" : "1", 258 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 259 | "rdt:type" : "Data", 260 | "rdt:scope" : "R_GlobalEnv", 261 | "rdt:fromEnv" : "FALSE", 262 | "rdt:MD5hash" : "", 263 | "rdt:timestamp" : "", 264 | "rdt:location" : "" 265 | } , 266 | 267 | "d2" : { 268 | "rdt:name" : "y", 269 | "rdt:value" : "3", 270 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 271 | "rdt:type" : "Data", 272 | "rdt:scope" : "R_GlobalEnv", 273 | "rdt:fromEnv" : "FALSE", 274 | "rdt:MD5hash" : "", 275 | "rdt:timestamp" : "", 276 | "rdt:location" : "" 277 | } , 278 | 279 | "d3" : { 280 | "rdt:name" : "x", 281 | "rdt:value" : "4", 282 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["numeric"]}, 283 | "rdt:type" : "Data", 284 | "rdt:scope" : "R_GlobalEnv", 285 | "rdt:fromEnv" : "FALSE", 286 | "rdt:MD5hash" : "", 287 | "rdt:timestamp" : "", 288 | "rdt:location" : "" 289 | } , 290 | 291 | "d4" : { 292 | "rdt:name" : "test.test", 293 | "rdt:value" : "data/4-test.test", 294 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 295 | "rdt:type" : "File", 296 | "rdt:scope" : "undefined", 297 | "rdt:fromEnv" : "FALSE", 298 | "rdt:MD5hash" : "NA", 299 | "rdt:timestamp" : "2018-03-19T12.21.18EDT", 300 | "rdt:location" : "/Users/hermes/test.test" 301 | } , 302 | 303 | "d5" : { 304 | "rdt:name" : "dev.2", 305 | "rdt:value" : "\"graph\"", 306 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 307 | "rdt:type" : "Data", 308 | "rdt:scope" : "undefined", 309 | "rdt:fromEnv" : "FALSE", 310 | "rdt:MD5hash" : "", 311 | "rdt:timestamp" : "", 312 | "rdt:location" : "" 313 | } , 314 | 315 | "d6" : { 316 | "rdt:name" : "dev.2", 317 | "rdt:value" : "\"graph\"", 318 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 319 | "rdt:type" : "Data", 320 | "rdt:scope" : "undefined", 321 | "rdt:fromEnv" : "FALSE", 322 | "rdt:MD5hash" : "", 323 | "rdt:timestamp" : "", 324 | "rdt:location" : "" 325 | } , 326 | 327 | "d7" : { 328 | "rdt:name" : "test.pdf", 329 | "rdt:value" : "data/7-test.pdf", 330 | "rdt:valType" : {"container":"vector", "dimension":[1], "type":["character"]}, 331 | "rdt:type" : "File", 332 | "rdt:scope" : "undefined", 333 | "rdt:fromEnv" : "FALSE", 334 | "rdt:MD5hash" : "NA", 335 | "rdt:timestamp" : "2018-03-19T12.21.18EDT", 336 | "rdt:location" : "/Users/hermes/test.pdf" 337 | }}, 338 | "wasInformedBy":{ 339 | 340 | "e1" : { 341 | "prov:informant" : "p1", 342 | "prov:informed" : "p2" 343 | } , 344 | 345 | "e3" : { 346 | "prov:informant" : "p2", 347 | "prov:informed" : "p3" 348 | } , 349 | 350 | "e5" : { 351 | "prov:informant" : "p3", 352 | "prov:informed" : "p4" 353 | } , 354 | 355 | "e6" : { 356 | "prov:informant" : "p4", 357 | "prov:informed" : "p5" 358 | } , 359 | 360 | "e8" : { 361 | "prov:informant" : "p5", 362 | "prov:informed" : "p6" 363 | } , 364 | 365 | "e12" : { 366 | "prov:informant" : "p6", 367 | "prov:informed" : "p7" 368 | } , 369 | 370 | "e14" : { 371 | "prov:informant" : "p7", 372 | "prov:informed" : "p8" 373 | } , 374 | 375 | "e16" : { 376 | "prov:informant" : "p8", 377 | "prov:informed" : "p9" 378 | } , 379 | 380 | "e19" : { 381 | "prov:informant" : "p9", 382 | "prov:informed" : "p10" 383 | } , 384 | 385 | "e21" : { 386 | "prov:informant" : "p10", 387 | "prov:informed" : "p11" 388 | } , 389 | 390 | "e25" : { 391 | "prov:informant" : "p11", 392 | "prov:informed" : "p12" 393 | } , 394 | 395 | "e28" : { 396 | "prov:informant" : "p12", 397 | "prov:informed" : "p13" 398 | }}, 399 | "wasGeneratedBy":{ 400 | 401 | "e2" : { 402 | "prov:entity" : "d1", 403 | "prov:activity" : "p2" 404 | } , 405 | 406 | "e4" : { 407 | "prov:entity" : "d2", 408 | "prov:activity" : "p3" 409 | } , 410 | 411 | "e11" : { 412 | "prov:entity" : "d3", 413 | "prov:activity" : "p6" 414 | } , 415 | 416 | "e18" : { 417 | "prov:entity" : "d4", 418 | "prov:activity" : "p9" 419 | } , 420 | 421 | "e20" : { 422 | "prov:entity" : "d5", 423 | "prov:activity" : "p10" 424 | } , 425 | 426 | "e24" : { 427 | "prov:entity" : "d6", 428 | "prov:activity" : "p11" 429 | } , 430 | 431 | "e26" : { 432 | "prov:entity" : "d7", 433 | "prov:activity" : "p12" 434 | }}, 435 | "used":{ 436 | 437 | "e7" : { 438 | "prov:activity" : "p5", 439 | "prov:entity" : "d1" 440 | } , 441 | 442 | "e9" : { 443 | "prov:activity" : "p6", 444 | "prov:entity" : "d1" 445 | } , 446 | 447 | "e10" : { 448 | "prov:activity" : "p6", 449 | "prov:entity" : "d2" 450 | } , 451 | 452 | "e13" : { 453 | "prov:activity" : "p7", 454 | "prov:entity" : "d3" 455 | } , 456 | 457 | "e15" : { 458 | "prov:activity" : "p8", 459 | "prov:entity" : "d2" 460 | } , 461 | 462 | "e17" : { 463 | "prov:activity" : "p9", 464 | "prov:entity" : "d3" 465 | } , 466 | 467 | "e22" : { 468 | "prov:activity" : "p11", 469 | "prov:entity" : "d3" 470 | } , 471 | 472 | "e23" : { 473 | "prov:activity" : "p11", 474 | "prov:entity" : "d5" 475 | } , 476 | 477 | "e27" : { 478 | "prov:activity" : "p12", 479 | "prov:entity" : "d6" 480 | }} 481 | } 482 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------