diff --git a/.Rbuildignore b/.Rbuildignore index 91114bf..4b3f9f2 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,2 +1,3 @@ ^.*\.Rproj$ ^\.Rproj\.user$ +^data-raw$ diff --git a/DESCRIPTION b/DESCRIPTION index 365c04f..2648e36 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,10 +1,13 @@ Package: ifm Type: Package Title: Financial evaluation of Projects -Version: 0.1.0 +Version: 0.2.0 Author: Antoanne Christopher Pontes Wanderley Authors@R: c( person("Antoanne", "Pontes", email = "antoanne@ufrj.br", role = c("aut", "ctb", "cre")), + person("Elton", "Marinho", email = "elton.marinho@ppgi.ufrj.br", role = c("ctb")), + person("Monica", "Silva", email = "monica.silva@ppgi.ufrj.br", role = c("ctb")), + person("Sergio", "Serra", email = "serra@ppgi.ufrj.br", role = c("ctb")), person("Eber", "Schmitz", email = "eber@nce.ufrj.br", role = c("ctb")), person("Alexandre", "Costa", email = "afcosta@br.ibm.com", role = "ctb"), person("Anderson", "Nepomuceno", email = "anepomuceno@gmail.com", role = "ctb"), @@ -25,3 +28,5 @@ NeedsCompilation: no RoxygenNote: 7.1.1 Imports: igraph, XLConnect, openxlsx, RUnit Date: 2018-07-31 +Depends: R (>= 2.10) +LazyData: true diff --git a/R/data.R b/R/data.R new file mode 100644 index 0000000..9b02729 --- /dev/null +++ b/R/data.R @@ -0,0 +1,7 @@ +#' Sample dataset following Denne sample. +#' +#' TODO +#' +#' @format A data frame with 6 variables: +#' +"ex.sheet.data" diff --git a/R/excel.list.to.xls.R b/R/excel.list.to.xls.R index ffa7290..959bbea 100644 --- a/R/excel.list.to.xls.R +++ b/R/excel.list.to.xls.R @@ -31,7 +31,7 @@ #' #' @examples #' -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +#' data("ex.sheet.data") #' ex.sheet.data.interest.rate <- ex.sheet.data[[1]] #' ex.sheet.data.activities <- ex.sheet.data[[2]] #' ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/R/excel.xls.to.list.R b/R/excel.xls.to.list.R index a005d38..18d5639 100644 --- a/R/excel.xls.to.list.R +++ b/R/excel.xls.to.list.R @@ -25,11 +25,9 @@ #' #' @import XLConnect #' -#' @examples -#' -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") -#' -#' + +# ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") + excel.xls.to.list <- excel_xls_to_list <- excelXlsToList <- function(xls.spreadsheet.path){ diff --git a/R/mmf.df.1r.R b/R/mmf.df.1r.R index 3fd2b38..8e83b02 100644 --- a/R/mmf.df.1r.R +++ b/R/mmf.df.1r.R @@ -9,7 +9,7 @@ #' @export #' @examples #' -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +#' data("ex.sheet.data") #' ex.sheet.data.interest.rate <- ex.sheet.data[[1]] #' ex.sheet.data.activities <- ex.sheet.data[[2]] #' ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/R/mmf.df.infr.R b/R/mmf.df.infr.R index 713c493..df4d7d3 100644 --- a/R/mmf.df.infr.R +++ b/R/mmf.df.infr.R @@ -7,7 +7,7 @@ #' @export #' @examples #' -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +#' data("ex.sheet.data") #' ex.sheet.data.interest.rate <- ex.sheet.data[[1]] #' ex.sheet.data.activities <- ex.sheet.data[[2]] #' ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/R/mmf.get.breakeven.R b/R/mmf.get.breakeven.R index 128b929..f679e74 100644 --- a/R/mmf.get.breakeven.R +++ b/R/mmf.get.breakeven.R @@ -8,7 +8,7 @@ #' @family scheduling #' @examples #' -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +#' data("ex.sheet.data") #' ex.sheet.data.interest.rate <- ex.sheet.data[[1]] #' ex.sheet.data.activities <- ex.sheet.data[[2]] #' ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/R/mmf.get.selffunding.R b/R/mmf.get.selffunding.R index 1f2a538..eec3b18 100644 --- a/R/mmf.get.selffunding.R +++ b/R/mmf.get.selffunding.R @@ -8,7 +8,7 @@ #' @family scheduling #' @examples #' -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +#' data("ex.sheet.data") #' ex.sheet.data.interest.rate <- ex.sheet.data[[1]] #' ex.sheet.data.activities <- ex.sheet.data[[2]] #' ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/R/mmf.max.npv.R b/R/mmf.max.npv.R index 8146637..998bd50 100644 --- a/R/mmf.max.npv.R +++ b/R/mmf.max.npv.R @@ -10,7 +10,7 @@ #' @export #' @examples #' -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +#' data("ex.sheet.data") #' ex.sheet.data.interest.rate <- ex.sheet.data[[1]] #' ex.sheet.data.activities <- ex.sheet.data[[2]] #' ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/R/mmf.npv.R b/R/mmf.npv.R index 4daa108..d29744e 100644 --- a/R/mmf.npv.R +++ b/R/mmf.npv.R @@ -25,8 +25,7 @@ #' #' @examples #' -#' # Loading data from XLS -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +#' data("ex.sheet.data") #' ex.sheet.data.interest.rate <- ex.sheet.data[[1]] #' ex.sheet.data.activities <- ex.sheet.data[[2]] #' ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/R/predecessors.to.edges.R b/R/predecessors.to.edges.R index a926636..5556948 100644 --- a/R/predecessors.to.edges.R +++ b/R/predecessors.to.edges.R @@ -20,7 +20,7 @@ #' #' @examples #' -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +#' data("ex.sheet.data") #' ex.edges <- predecessors.to.edges(ex.sheet.data$predecessors) #' predecessors.to.edges <- predecessors_to_edges <- predecessorsToEdges <- diff --git a/R/utils.R b/R/utils.R index d805b37..92f83e8 100644 --- a/R/utils.R +++ b/R/utils.R @@ -17,7 +17,7 @@ #' #' @examples #' -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +#' data("ex.sheet.data") #' act.pred <- utils.suc2pred(ex.sheet.data$predecessors) #' utils.suc2pred <- function(activities.successors) { @@ -58,7 +58,7 @@ utils.suc2pred <- function(activities.successors) { #' #' @examples #' -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +#' data("ex.sheet.data") #' act.suc <- utils.pred2suc(ex.sheet.data$predecessors) #' utils.pred2suc <- function(activities.predecessors) { @@ -100,7 +100,7 @@ utils.pred2suc <- function(activities.predecessors) { #' #' @examples #' -#' ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +#' data("ex.sheet.data") #' g <- utils.pred2graph(ex.sheet.data$predecessors) #' plot(g) #' diff --git a/README.md b/README.md index bd25bbe..739803b 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,23 @@ This is part of the research project that aims to understand how we can enhance To use this package please do the following steps: -1 - install / download (git clone) R ifm package; +Install on R -2 - fill the spreadsheet and validate the named ranges: interestrate, activities, etc... +Use this command: devtools::install_github("antoanne/ifmFramework", INSTALL_opts=c("--no-multiarch")) -3 - put the spreadsheet on the /resources directory; -4 - run the function xpto. +Execute sample following this steps + +1. Import IFM package +library(ifm) + +2. Load demo +demo(sampledenne) + + + + + + +References +Denne, M., & Cleland-Huang, J. (2003). Software by numbers: Low-risk, high-return development. Prentice Hall Professional. diff --git a/demo/resources/spreadsheet.xls b/data-raw/spreadsheet.xls similarity index 100% rename from demo/resources/spreadsheet.xls rename to data-raw/spreadsheet.xls diff --git a/data-raw/workbook.R b/data-raw/workbook.R new file mode 100644 index 0000000..2120d1d --- /dev/null +++ b/data-raw/workbook.R @@ -0,0 +1,6 @@ +library(XLConnect) +library(ifm) + +ex.sheet.data <- excel.xls.to.list('data-raw/spreadsheet.xls') + +usethis::use_data(ex.sheet.data, overwrite = TRUE) diff --git a/data/ex.sheet.data.rda b/data/ex.sheet.data.rda new file mode 100644 index 0000000..680bf85 Binary files /dev/null and b/data/ex.sheet.data.rda differ diff --git a/demo/sampledenne.R b/demo/sampledenne.R index e56e195..86cdfc9 100644 --- a/demo/sampledenne.R +++ b/demo/sampledenne.R @@ -2,7 +2,7 @@ library(ifm) library(igraph) library(XLConnect) -ex.sheet.data <- excel.xls.to.list('demo/resources/spreadsheet.xls') +data("ex.sheet.data") ex.sheet.data.interest.rate <- ex.sheet.data[[1]] ex.sheet.data.activities <- ex.sheet.data[[2]] ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/man/ex.sheet.data.Rd b/man/ex.sheet.data.Rd new file mode 100644 index 0000000..142a16c --- /dev/null +++ b/man/ex.sheet.data.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{ex.sheet.data} +\alias{ex.sheet.data} +\title{Sample dataset following Denne sample.} +\format{ +A data frame with 6 variables: +} +\usage{ +ex.sheet.data +} +\description{ +TODO +} +\keyword{datasets} diff --git a/man/excel.list.to.xls.Rd b/man/excel.list.to.xls.Rd index 489ddf0..5a8c8d1 100644 --- a/man/excel.list.to.xls.Rd +++ b/man/excel.list.to.xls.Rd @@ -30,7 +30,7 @@ The file contains: } \examples{ -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +data("ex.sheet.data") ex.sheet.data.interest.rate <- ex.sheet.data[[1]] ex.sheet.data.activities <- ex.sheet.data[[2]] ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/man/excel.xls.to.list.Rd b/man/excel.xls.to.list.Rd index a116f70..9160912 100644 --- a/man/excel.xls.to.list.Rd +++ b/man/excel.xls.to.list.Rd @@ -23,12 +23,6 @@ representing the project, and return a list with the following information durations of activities, the list of predecessors of activities, the matrix that represents the cash flow series and the graph edges based on the predecessor list -} -\examples{ - -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") - - } \seealso{ Other utility: diff --git a/man/mmf.df.1r.Rd b/man/mmf.df.1r.Rd index 5b1503b..e7dcaa6 100644 --- a/man/mmf.df.1r.Rd +++ b/man/mmf.df.1r.Rd @@ -24,7 +24,7 @@ Self Funding } \examples{ -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +data("ex.sheet.data") ex.sheet.data.interest.rate <- ex.sheet.data[[1]] ex.sheet.data.activities <- ex.sheet.data[[2]] ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/man/mmf.df.infr.Rd b/man/mmf.df.infr.Rd index cfef46d..d07260d 100644 --- a/man/mmf.df.infr.Rd +++ b/man/mmf.df.infr.Rd @@ -20,7 +20,7 @@ Generates a data frame with Schedule, NPV, Breakeven and Self Funding } \examples{ -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +data("ex.sheet.data") ex.sheet.data.interest.rate <- ex.sheet.data[[1]] ex.sheet.data.activities <- ex.sheet.data[[2]] ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/man/mmf.get.breakeven.Rd b/man/mmf.get.breakeven.Rd index 8c9bcb4..a3c30fd 100644 --- a/man/mmf.get.breakeven.Rd +++ b/man/mmf.get.breakeven.Rd @@ -18,7 +18,7 @@ Get a list with all Breakeven points from CFS } \examples{ -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +data("ex.sheet.data") ex.sheet.data.interest.rate <- ex.sheet.data[[1]] ex.sheet.data.activities <- ex.sheet.data[[2]] ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/man/mmf.get.selffunding.Rd b/man/mmf.get.selffunding.Rd index 1508fdb..163c5fe 100644 --- a/man/mmf.get.selffunding.Rd +++ b/man/mmf.get.selffunding.Rd @@ -18,7 +18,7 @@ Get a list with all Selffunding points from CFS } \examples{ -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +data("ex.sheet.data") ex.sheet.data.interest.rate <- ex.sheet.data[[1]] ex.sheet.data.activities <- ex.sheet.data[[2]] ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/man/mmf.max.npv.Rd b/man/mmf.max.npv.Rd index 5199060..29cd3d3 100644 --- a/man/mmf.max.npv.Rd +++ b/man/mmf.max.npv.Rd @@ -21,7 +21,7 @@ this function identifies the sequence of activities and respectivies schedules w } \examples{ -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +data("ex.sheet.data") ex.sheet.data.interest.rate <- ex.sheet.data[[1]] ex.sheet.data.activities <- ex.sheet.data[[2]] ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/man/mmf.npv.Rd b/man/mmf.npv.Rd index 294e50c..2be7aeb 100644 --- a/man/mmf.npv.Rd +++ b/man/mmf.npv.Rd @@ -29,8 +29,7 @@ Calculates NPV for all schedules } \examples{ -# Loading data from XLS -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +data("ex.sheet.data") ex.sheet.data.interest.rate <- ex.sheet.data[[1]] ex.sheet.data.activities <- ex.sheet.data[[2]] ex.sheet.data.durations <- ex.sheet.data[[3]] diff --git a/man/predecessors.to.edges.Rd b/man/predecessors.to.edges.Rd index 04b9033..f604807 100644 --- a/man/predecessors.to.edges.Rd +++ b/man/predecessors.to.edges.Rd @@ -21,7 +21,7 @@ plotted by the draw.graph function. } \examples{ -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +data("ex.sheet.data") ex.edges <- predecessors.to.edges(ex.sheet.data$predecessors) } diff --git a/man/utils.pred2graph.Rd b/man/utils.pred2graph.Rd index bd0218d..091da65 100644 --- a/man/utils.pred2graph.Rd +++ b/man/utils.pred2graph.Rd @@ -17,7 +17,7 @@ This function plot activities.predecessors to graph. } \examples{ -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +data("ex.sheet.data") g <- utils.pred2graph(ex.sheet.data$predecessors) plot(g) diff --git a/man/utils.pred2suc.Rd b/man/utils.pred2suc.Rd index cb0ca15..6d65002 100644 --- a/man/utils.pred2suc.Rd +++ b/man/utils.pred2suc.Rd @@ -18,7 +18,7 @@ activities.successors. } \examples{ -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +data("ex.sheet.data") act.suc <- utils.pred2suc(ex.sheet.data$predecessors) } diff --git a/man/utils.suc2pred.Rd b/man/utils.suc2pred.Rd index 7f5c48d..90c51b8 100644 --- a/man/utils.suc2pred.Rd +++ b/man/utils.suc2pred.Rd @@ -18,7 +18,7 @@ activities.predecessors. } \examples{ -ex.sheet.data <- excel.xls.to.list("../ifm/demo/resources/spreadsheet.xls") +data("ex.sheet.data") act.pred <- utils.suc2pred(ex.sheet.data$predecessors) }