Skip to content

Commit

Permalink
remove dependencies (dplyr, matrixStats)
Browse files Browse the repository at this point in the history
part of #28
  • Loading branch information
GregorDeCillia committed May 27, 2020
1 parent 326adae commit bca7dcc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Description: Calculate point estimates and their standard errors in complex hous
Encoding: UTF-8
LazyData: true
License: GPL (>= 2)
Imports: Rcpp (>= 0.12.12),data.table,matrixStats, ggplot2, laeken, methods, dplyr
Imports: Rcpp (>= 0.12.12),data.table,ggplot2,laeken,methods
LinkingTo: Rcpp
URL: https://github.com/statistikat/surveysd
BugReports: https://github.com/statistikat/surveysd/issues
Expand Down
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import(data.table)
import(ggplot2)
importFrom("graphics","plot")
importFrom("laeken","weightedMedian")
importFrom("matrixStats","rowProds")
importFrom("methods","formalArgs")
importFrom("stats","as.formula")
importFrom("stats","formula")
Expand All @@ -36,5 +35,4 @@ importFrom("utils","data")
importFrom("utils","find")
importFrom("utils","head")
importFrom("utils","tail")
importFrom(dplyr,recode)
useDynLib(surveysd)
8 changes: 4 additions & 4 deletions R/demo.eusilc.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#' * `povertyRisk`. Logical variable determining whether a respondent is at risk
#' of poverty
#'
#' @importFrom dplyr recode
#' @examples
#' demo.eusilc(n = 1, prettyNames = TRUE)[, c(1:8, 26, 28:30)]
#' @export
Expand Down Expand Up @@ -71,9 +70,10 @@ demo.eusilc <- function(n = 8, prettyNames = FALSE) {
data.table::setnames(eusilc, "rb090", "gender")
data.table::setnames(eusilc, "pb220a", "citizenship")
data.table::setnames(eusilc, "pl030", "ecoStat")
eusilc[, ecoStat := dplyr::recode(
ecoStat, `1` = "full time", `2` = "part time", `3` = "unemployed",
`4` = "education", `5` = "retired", `6` = "disabled", `7` = "domestic")]
eusilc[, ecoStat := factor(ecoStat, labels = c(
"full time", "part time", "unemployed",
"education", "retired", "disabled", "domestic"
))]
data.table::setnames(eusilc, "rb050", "pWeight")
data.table::setnames(eusilc, "povmd60", "povertyRisk")
eusilc[, povertyRisk := as.logical(povertyRisk)]
Expand Down
10 changes: 8 additions & 2 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@
#' @importFrom "graphics" "plot"
#' @importFrom "stats" "as.formula" "na.omit" "quantile" "sd" "xtabs" "formula"
#' @importFrom "utils" "data" "find" "tail" "head"
#' @importFrom "matrixStats" "rowProds"
#' @importFrom "laeken" "weightedMedian"
#' @importFrom "methods" "formalArgs"
#' @useDynLib surveysd


rowProds <- function(x) {
n <- nrow(x)
y <- double(length = n)
for (ii in seq_len(n)) {
y[ii] <- prod(x[ii, , drop = TRUE], na.rm = na.rm)
}
y
}


dt.eval <- function(..., env = parent.frame()) {
Expand Down

0 comments on commit bca7dcc

Please sign in to comment.