Skip to content
Permalink
Browse files

epsP and epsH included as arguments to recalib(); tests updated

  • Loading branch information
Johannes Gussenbauer - QM
Johannes Gussenbauer - QM committed Jan 7, 2020
1 parent 3fee6ed commit 3def4390b8e87f92ee726242ed4e1057cad88ae3
@@ -267,10 +267,10 @@ calibH <- function(i, dat, error, valueH, hColNames, bound, verbose, calIter,
!is.na(fVariableForCalibrationIPF) &
(abs(1 / fVariableForCalibrationIPF - 1) > epsHcur),
list(maxFac = max(abs(1 / fVariableForCalibrationIPF - 1)), .N,
head(epsHcur, 1),
epsH = head(epsHcur, 1),
sumCalibWeight = sum(get(variableKeepingTheCalibWeight) *
representativeHouseholdForCalibration),
head(value, 1)),
PopMargin = head(value, 1)),
by = eval(hColNames[[i]])]
print(tmp[order(maxFac, decreasing = TRUE), ])

@@ -549,7 +549,7 @@ ipf <- function(

OriginalSortingVariable <- V1 <- epsvalue <-
f <- temporary_hvar <-
value <- wValue <- representativeHouseholdForCalibration <- NULL
value <- wValue <- representativeHouseholdForCalibration <- ..hid <- NULL
dat_original <- dat
dat <- copy(dat)
## originalsorting is fucked up without this
@@ -46,6 +46,8 @@
#' @param conH.var character vector containig household-specific variables to
#' which weights should be calibrated or a list of such character vectors. Contingency tables for the population
#' are calculated per `period` using `weights`.
#' @param epsP numeric value specifying the convergence limit for `conP.var` or `conP`, see [ipf()].
#' @param epsH numeric value specifying the convergence limit for `conH.var` or `conH`, see [ipf()].
#' @param ... additional arguments passed on to function [ipf()] from this
#' package.
#'
@@ -71,19 +73,20 @@
#' strata = "region", period = "year")
#'
#' # calibrate weight for bootstrap replicates
#' dat_boot_calib <- recalib(dat_boot, conP.var = "gender", conH.var = "region")
#' dat_boot_calib <- recalib(dat_boot, conP.var = "gender", conH.var = "region",
#' verbose = TRUE)
#'
#'
#' # calibrate on other variables
#' dat_boot_calib <- recalib(dat_boot, conP.var = c("gender", "age"),
#' conH.var = c("region", "hsize"))
#' conH.var = c("region", "hsize"), verbose = TRUE)
#'
#' # supply contingency tables directly
#' conP <- xtabs(pWeight ~ age + gender + year, data = eusilc)
#' conH <- xtabs(pWeight ~ hsize + region + year, data = eusilc[!duplicated(paste(db030,year))])
#' dat_boot_calib <- recalib(dat_boot, conP.var = NULL,
#' conH.var = NULL, conP = list(conP),
#' conH = list(conH))
#' conH = list(conH), verbose = TRUE)
#' }
#'
#' @export recalib
@@ -92,10 +95,11 @@
recalib <- function(
dat, hid = attr(dat, "hid"), weights = attr(dat, "weights"), b.rep =
attr(dat, "b.rep"), period = attr(dat, "period"), conP.var = NULL,
conH.var = NULL, ...) {
conH.var = NULL, epsP = 1e-2, epsH = 2e-2, ...) {

verbose <- epsP <- epsH <- bound <- maxIter <- meanHH <- check_hh_vars <-
hidfactor <- calibWeight <- FirstPersonInHousehold_ <- NULL
hidfactor <- calibWeight <- FirstPersonInHousehold_ <- verbose <-
bound <- maxiter <- meanHH <- check_hh_vars <- allPthenH <-
returnNA <- conversion_messages <- maxIter <- NULL

##########################################################
# INPUT CHECKING
@@ -160,33 +164,27 @@ recalib <- function(
##########################################################

# define default values for ipf
ipfDefaults <- formals(ipf)
ipfDefaults <- ipfDefaults[!names(ipfDefaults)%in%names(formals(recalib))]
ellipsis <- list(...)
# set these to FALSE by default
ellipsis[["check_hh_vars"]] <- getEllipsis2("check_hh_vars",
FALSE, ellipsis)
ellipsis[["conversion_messages"]] <- getEllipsis2("conversion_messages",
FALSE, ellipsis)
ellipsis[["verbose"]] <- getEllipsis2("verbose", TRUE, ellipsis)
ellipsis[["epsP"]] <- getEllipsis2("epsP", 1e-2, ellipsis)
ellipsis[["epsH"]] <- getEllipsis2("epsH", 5e-2, ellipsis)
ellipsis[["conP"]] <- getEllipsis2("conP", NULL, ellipsis)
ellipsis[["conH"]] <- getEllipsis2("conH", NULL, ellipsis)
ellipsis[["bound"]] <- getEllipsis2("bound", 4, ellipsis)
ellipsis[["maxIter"]] <- getEllipsis2("maxIter", 100, ellipsis)
ellipsis[["meanHH"]] <- getEllipsis2("meanHH", TRUE, ellipsis)
ellipsis[["check_hh_vars"]] <- getEllipsis2("check_hh_vars", FALSE, ellipsis)
ellipsis[["conversion_messages"]] <- getEllipsis2("conversion_messages", FALSE,
ellipsis)

ellipsis <- lapply(names(ipfDefaults),function(z){
getEllipsis2(z,ipfDefaults[[z]],ellipsis)
})
names(ellipsis) <- names(ipfDefaults)

ellipsisNames <- names(ellipsis)
ellipsisContent <- paste0("ellipsis[['",ellipsisNames,"']]")
eval(parse(text = paste(
ellipsisNames,
ellipsisContent, sep = "<-"
)))

if(length(ellipsis[["conH"]])==0){
conH <- NULL
}
if(length(ellipsis[["conP"]])==0){
conP <- NULL
}


# check conP and conH
conPnames <- lapply(conP,function(z){
z <- names(dimnames(z))
@@ -228,7 +226,7 @@ recalib <- function(
# recode household and person variables to factor
# improves runtime for ipf
#
vars <- c(period, unique(unlist(c(conP.var,conH.var))))
vars <- c(period, unique(unlist(c(conP.var,conH.var,conPnames,conHnames))))
vars.class <- unlist(lapply(dat[, mget(vars)], function(z) {
z.class <- class(z)
if (z.class[1] == "labelled"){
@@ -246,26 +244,23 @@ recalib <- function(

# calculate contingency tables
for(p in seq_along(conP.var)){
existTab <- sapply(conPnames,setequal,y=conP.var[p])
existTab <- sapply(conPnames,setequal,y=conP.var[[p]])
if(all(!existTab)){
conP <- c(conP,
makeCalibTable(dat,weights=weights,period=period,
vars=conP.var[[p]]))
formTab <- paste(weights,"~",paste(c(period,conP.var[[p]]),collapse="+"))
conP <- c(conP,list(xtabs(formTab,data=dat)))
}else{
stop("contingency table for ",paste(conP.var[p],collapse = ", ")," was supplied through paramter conP AND conP.var")
}
}

dat[,FirstPersonInHousehold_:=c(1L,rep(0,.N-1)),by=c(hid,period)]
for(h in seq_along(conH.var)){
existTab <- sapply(conHnames,setequal,y=conH.var[h])
existTab <- sapply(conHnames,setequal,y=conH.var[[h]])
if(all(!existTab)){
conH <- c(conH,
makeCalibTable(dat[FirstPersonInHousehold_==1],
weights=weights,period=period,
vars=conH.var[[h]]))
formTab <- paste(weights,"~",paste(c(period,conH.var[[h]]),collapse="+"))
conH <- c(conH,list(xtabs(formTab,data=dat[FirstPersonInHousehold_==1])))
}else{
stop("contingency table for ",paste(conH.var[h],collapse = ", ")," was supplied through paramter conH AND conH.var")
stop("contingency table for ",paste(conH.var[[h]],collapse = ", ")," was supplied through paramter conH AND conH.var")
}
}

@@ -276,7 +271,7 @@ recalib <- function(
# calibrate weights to conP and conH
select.var <- unique(c("hidfactor", weights, period, unlist(c(conP.var,conH.var,conPnames,conHnames))))
calib.fail <- c()

for (g in b.rep) {
set(dat, j = g, value = dt.eval("dat[,", g, "*", weights, "]"))

@@ -292,7 +287,7 @@ recalib <- function(
nrow(check.z) > 0
})

if (!is.null(conP.var) | !is.null(conH.var)) {
if (!is.null(conP) | !is.null(conH)) {
if (any(unlist(c(check.conH, check.conP)))) {
calib.fail <- c(calib.fail, g)
set(dat, j = g, value = NA_real_)
@@ -301,7 +296,9 @@ recalib <- function(
dat = copy(dat[, mget(c(g, select.var))]), conP = conP,
conH = conH, verbose = verbose, epsP = epsP, epsH = epsH,
w = g, bound = bound, maxIter = maxIter, meanHH = meanHH,
hid = "hidfactor", check_hh_vars = check_hh_vars
hid = "hidfactor", check_hh_vars = check_hh_vars,
allPthenH = allPthenH, returnNA = returnNA,
conversion_messages = conversion_messages
)[, calibWeight])
if (dat[, any(is.na(get(g)))]) {
calib.fail <- c(calib.fail, g)

Some generated files are not rendered by default. Learn more.

BIN -3.06 KB src/symbols.rds
Binary file not shown.
@@ -13,7 +13,8 @@ eusilc <- eusilc[!db040 %in% c("Vienna", "Lower Austria", "Upper Austria")]

eusilc <- draw.bootstrap(eusilc, REP = 2, hid = "db030", weights = "db090",
period = "year", strata = "db040")
eusilc <- recalib(eusilc, conP.var = "rb090", conH.var = "db040")
eusilc <- recalib(eusilc, conP.var = c("rb090", "age"),
conH.var = c("db040", "hsize"))

# test input parameter
test_that("test para - data", {
@@ -15,7 +15,8 @@ if (Sys.getenv("SURVEYSD_ADDITIONAL_TEST") == "TRUE") {
period = "year", strata = "db040")
eusilc <- recalib(
eusilc, hid = "db030", weights = "db090", b.rep = paste0("w", 1:2),
period = "year", conP.var = "rb090", conH.var = "db040")
period = "year", conP.var = c("rb090", "age"),
conH.var = c("db040", "hsize"))

# these are some longer tests

@@ -13,7 +13,8 @@ eusilc <- eusilc[!db040 %in% c("Vienna", "Lower Austria", "Upper Austria")]

eusilc <- draw.bootstrap(eusilc, REP = 2, hid = "db030", weights = "db090",
period = "year", strata = "db040")
eusilc <- recalib(eusilc, conP.var = "rb090", conH.var = "db040")
eusilc <- recalib(eusilc, conP.var = c("rb090", "age"),
conH.var = c("db040", "hsize"))
res <- calc.stError(eusilc, var = "povmd60", group =
list("rb090", "db040", c("rb090", "db040"), "hsize"))

@@ -7,7 +7,7 @@ library(surveysd)
library(laeken)
library(data.table)

eusilc <- surveysd:::demo.eusilc()
eusilc <- surveysd:::demo.eusilc(n=4)
eusilc <- draw.bootstrap(eusilc, REP = 2, hid = "db030", weights = "db090",
period = "year", strata = "db040")

@@ -82,7 +82,7 @@ test_that("test para - conP conH", {
conP2 <- xtabs(db090 ~ rb090 + year, data = eusilc)
# conP2 <- xtabs(db090 ~ rb090 + db040 + year, data = eusilc)

conH1 <- xtabs(db090 ~ hsize + db040 + year, data = eusilc[!duplicated(paste(db030,year))])
conH1 <- xtabs(db090 ~ hsize + year, data = eusilc[!duplicated(paste(db030,year))])
conH2 <- xtabs(db090 ~ db040 + year, data = eusilc[!duplicated(paste(db030,year))])

expect_error(
@@ -103,7 +103,7 @@ test_that("test para - conP conH", {
test_that("test return", {
dat.calib <- recalib(
eusilc, hid = "db030", weights = "db090", b.rep = paste0("w", 1:2), period =
"year", conP.var = "rb090", conH.var = "db040")
"year", conP.var = c("rb090", "age"), conH.var = c("db040", "hsize"))
rb090.compare <- dat.calib[, lapply(.SD, sum), by = list(year, rb090),
.SDcols = c("db090", paste0("w", 1:2))]
expect_true(all(!is.na(rb090.compare[, .SD, .SDcols = paste0("w", 1:2)])))
@@ -113,7 +113,7 @@ test_that("test return", {
abs(db090 - z) / db090
}
), .SDcols = paste0("w", 1:2)]
expect_true(all(rb090.compare < 0.01))
expect_true(all(rb090.compare < formals(recalib)$epsP))

db040.compare <- dat.calib[, lapply(
.SD,
@@ -127,5 +127,5 @@ test_that("test return", {
abs(db090 - z) / db090
}
), .SDcols = paste0("w", 1:2)]
expect_true(all(db040.compare < 0.05))
expect_true(all(db040.compare < formals(recalib)$epsH))
})
@@ -34,7 +34,8 @@ set.seed(1234)
eusilc <- demo.eusilc(prettyNames = TRUE)
dat_boot <- draw.bootstrap(eusilc, REP = 10, hid = "hid", weights = "pWeight",
strata = "region", period = "year")
dat_boot_calib <- recalib(dat_boot, conP.var = "gender", conH.var = "region")
dat_boot_calib <- recalib(dat_boot, conP.var = "gender", conH.var = "region",
verbose = TRUE)
dat_boot_calib[, onePerson := nrow(.SD) == 1, by = .(year, hid)]
## print part of the dataset
@@ -47,7 +47,8 @@ Calibrate each sample according to the distribution of `gender` (on a personal l
(on a household level).

```{r}
dat_boot_calib <- recalib(dat_boot, conP.var = "gender", conH.var = "region")
dat_boot_calib <- recalib(dat_boot, conP.var = "gender", conH.var = "region",
verbose = TRUE)
dat_boot_calib[1:5, .(year, povertyRisk, gender, pWeight, w1, w2, w3, w4)]
```

1 comment on commit 3def439

@lintr-bot

This comment has been minimized.

Copy link

@lintr-bot lintr-bot commented on 3def439 Jan 7, 2020

R/calc.stError.R:15:5: warning: local variable ‘fun_original’ assigned but may not be used

fun_original <- fun # nolint
    ^~~~~~~~~~~~

R/calc.stError.R:116:1: style: Lines should not be more than 80 characters.

#' \deqn{fun(var,weights,...),fun(var,b.weights[1],...),fun(var,b.weights[2],...),...}
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/calc.stError.R:118:1: style: Lines should not be more than 80 characters.

#' \deqn{fun(var,weights,...),fun(var.1,b.weights[1],...),fun(var.2,b.weights[2],...),...}
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/calc.stError.R:251:25: style: There should be a space between right parenthesis and an opening curly brace.

#' fun <- function(x,w,b){
                        ^~

R/calc.stError.R:271:30: style: There should be a space between right parenthesis and an opening curly brace.

#' help_gini <- function(x, w){
                             ^~

R/calc.stError.R:290:26: style: There should be a space between right parenthesis and an opening curly brace.

#' povmd <- function(x, w){
                         ^~

R/calc.stError.R:310:27: style: There should be a space between right parenthesis and an opening curly brace.

#' povmd2 <- function(x, w){
                          ^~

R/calc.stError.R:342:1: style: functions should have cyclomatic complexity of less than 15, this has 60.

calc.stError <- function(
^

R/calc.stError.R:423:43: style: There should be a space between right parenthesis and an opening curly brace.

if (any(!unlist(add.arg) %in% c.names)){
                                          ^~

R/calc.stError.R:539:15: warning: Avoid 1:length(...) expressions, use seq_len.

for (i in 1:length(period.diff)) {
              ^

R/calc.stError.R:676:1: style: functions should have cyclomatic complexity of less than 15, this has 26.

help.stError <- function(
^

R/calc.stError.R:693:21: style: There should be a space between right parenthesis and an opening curly brace.

",national.arg){fun_original(x,w,add.arg)/national.arg*100}")
                    ^~

R/calc.stError.R:709:33: warning: Avoid 1:length(...) expressions, use seq_len.

res.names <- c(t(outer(var, 1:length(c(weights, b.weights)), paste_)))
                                ^

R/calc.stError.R:722:33: warning: Avoid 1:length(...) expressions, use seq_len.

res.names <- c(t(outer(var, 1:length(c(weights, b.weights)), paste_)))
                                ^

R/calc.stError.R:849:19: style: There should be a space between right parenthesis and an opening curly brace.

function(l){
                  ^~

R/calc.stError.R:950:60: style: There should be a space between right parenthesis and an opening curly brace.

diff.roll.Nn <- lapply(period.diff.mean, function(y){
                                                           ^~

R/computeFrac.R:21:1: style: Lines should not be more than 80 characters.

#'   \out{<center>&sum; f<sub>i</sub> w<sub>i</sub> x<sub>i</sub> = target</center>}
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/computeFrac.R:24:1: style: Lines should not be more than 80 characters.

#'   \out{<center>&sum; f<sub>i</sub> w<sub>i</sub> = &sum; w<sub>i</sub></center>}
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/computeFrac.R:43:47: style: There should be a space between right parenthesis and an opening curly brace.

computeFrac <- function(curValue, target, x, w){
                                              ^~

R/draw.bootstrap.R:6:29: warning: local variable ‘STRATA_VAR_HELP’ assigned but may not be used

occurence_first_period <- STRATA_VAR_HELP <- fpc <- NULL
                            ^~~~~~~~~~~~~~~

R/draw.bootstrap.R:6:48: warning: local variable ‘fpc’ assigned but may not be used

occurence_first_period <- STRATA_VAR_HELP <- fpc <- NULL
                                               ^~~

R/draw.bootstrap.R:155:17: style: There should be a space between right parenthesis and an opening curly brace.

#' for(y in year){
                ^~

R/draw.bootstrap.R:187:1: style: functions should have cyclomatic complexity of less than 15, this has 49.

draw.bootstrap <- function(
^

R/draw.bootstrap.R:191:7: warning: local variable ‘fpc.strata’ assigned but may not be used

fpc.strata <- strata[!strata %in% c("I", "1")] # nolint
      ^~~~~~~~~~

R/draw.bootstrap.R:204:1: style: Trailing whitespace is superfluous.

^~~~

R/draw.bootstrap.R:219:34: style: Commas should always have a space after.

hid <- generateRandomName(20,colnames(dat))
                                 ^

R/draw.bootstrap.R:221:32: style: Commas should always have a space after.

removeCols <- c(removeCols,hid)
                               ^

R/draw.bootstrap.R:244:37: style: Commas should always have a space after.

period <- generateRandomName(20,colnames(dat))
                                    ^

R/draw.bootstrap.R:246:32: style: Commas should always have a space after.

removeCols <- c(removeCols,period)
                               ^

R/draw.bootstrap.R:291:38: style: There should be a space between right parenthesis and an opening curly brace.

dat.na <- sapply(dat.na, function(z){
                                     ^~

R/draw.bootstrap.R:312:48: style: Commas should always have a space after.

strata_var_help <- generateRandomName(20,colnames(dat))
                                               ^

R/draw.bootstrap.R:313:12: style: Commas should always have a space after.

dat[,c(strata_var_help):=do.call(paste,c(.SD,sep="-")),]
           ^

R/draw.bootstrap.R:313:30: style: Put spaces around all infix operators.

dat[,c(strata_var_help):=do.call(paste,c(.SD,sep="-")),]
                            ~^~~

R/draw.bootstrap.R:313:46: style: Commas should always have a space after.

dat[,c(strata_var_help):=do.call(paste,c(.SD,sep="-")),]
                                             ^

R/draw.bootstrap.R:313:52: style: Commas should always have a space after.

dat[,c(strata_var_help):=do.call(paste,c(.SD,sep="-")),]
                                                   ^

R/draw.bootstrap.R:313:55: style: Put spaces around all infix operators.

dat[,c(strata_var_help):=do.call(paste,c(.SD,sep="-")),]
                                                     ~^~

R/draw.bootstrap.R:313:62: style: Commas should always have a space after.

dat[,c(strata_var_help):=do.call(paste,c(.SD,sep="-")),]
                                                             ^

R/draw.bootstrap.R:314:1: style: Lines should not be more than 80 characters.

​      dt.eval("dat[,",strata_var_help,":=paste(", paste0(strata, collapse = ","),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/draw.bootstrap.R:314:23: style: Commas should always have a space after.

​      dt.eval("dat[,",strata_var_help,":=paste(", paste0(strata, collapse = ","),
                      ^

R/draw.bootstrap.R:314:39: style: Commas should always have a space after.

​      dt.eval("dat[,",strata_var_help,":=paste(", paste0(strata, collapse = ","),
                                      ^

R/draw.bootstrap.R:317:34: style: Commas should always have a space after.

removeCols <- c(removeCols,strata)
                                 ^

R/draw.bootstrap.R:376:39: style: Commas should always have a space after.

totals <- generateRandomName(20,existingNames = colnames(dat))
                                      ^

R/draw.bootstrap.R:378:23: style: Commas should always have a space after.

​      dt.eval("dat[,",totals,":=sum(", weights, "[!duplicated(",
                      ^

R/draw.bootstrap.R:378:30: style: Commas should always have a space after.

​      dt.eval("dat[,",totals,":=sum(", weights, "[!duplicated(",
                             ^

R/draw.bootstrap.R:380:34: style: Commas should always have a space after.

removeCols <- c(removeCols,totals)
                                 ^

R/draw.bootstrap.R:440:5: style: Place a space before left parenthesis, except in a function call.

if(length(removeCols)>0){
    ^

R/draw.bootstrap.R:440:24: style: Put spaces around all infix operators.

if(length(removeCols)>0){
                      ~^~

R/draw.bootstrap.R:440:26: style: There should be a space between right parenthesis and an opening curly brace.

if(length(removeCols)>0){
                         ^~

R/draw.bootstrap.R:441:10: style: Commas should always have a space after.

dat[,c(removeCols):=NULL]
         ^

R/draw.bootstrap.R:441:23: style: Put spaces around all infix operators.

dat[,c(removeCols):=NULL]
                     ~^~~

R/generateHHID.R:40:17: style: There should be a space between right parenthesis and an opening curly brace.

#' for(y in year){
                ^~

R/generateHHID.R:67:1: style: functions should have cyclomatic complexity of less than 15, this has 16.

generate.HHID <- function(dat, period = "RB010", pid = "RB030", hid = "DB030"){
^

R/generateHHID.R:67:78: style: There should be a space between right parenthesis and an opening curly brace.

generate.HHID <- function(dat, period = "RB010", pid = "RB030", hid = "DB030"){
                                                                             ^~

R/helpers.R:23:17: style: There should be a space between right parenthesis and an opening curly brace.

function(z){
                ^~

R/helpers.R:39:34: style: Commas should always have a space after.

getEllipsis2 <- function(element,default,ell){
                                 ^

R/helpers.R:39:42: style: Commas should always have a space after.

getEllipsis2 <- function(element,default,ell){
                                         ^

R/helpers.R:39:45: style: There should be a space between right parenthesis and an opening curly brace.

getEllipsis2 <- function(element,default,ell){
                                            ^~

R/helpers.R:40:1: style: Trailing whitespace is superfluous.

^~

R/helpers.R:41:5: style: Place a space before left parenthesis, except in a function call.

if(is.null(ell[[element]])){
    ^

R/helpers.R:41:29: style: There should be a space between right parenthesis and an opening curly brace.

if(is.null(ell[[element]])){
                            ^~

R/helpers.R:49:32: style: Commas should always have a space after.

makeCalibTable <- function(dat,weights,period,vars){
                               ^

R/helpers.R:49:40: style: Commas should always have a space after.

makeCalibTable <- function(dat,weights,period,vars){
                                       ^

R/helpers.R:49:47: style: Commas should always have a space after.

makeCalibTable <- function(dat,weights,period,vars){
                                              ^

R/helpers.R:49:51: style: There should be a space between right parenthesis and an opening curly brace.

makeCalibTable <- function(dat,weights,period,vars){
                                                  ^~

R/helpers.R:51:28: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,vars),collapse="+"))
                           ^

R/helpers.R:51:32: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,vars),collapse="+"))
                               ^

R/helpers.R:51:47: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,vars),collapse="+"))
                                              ^

R/helpers.R:51:53: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,vars),collapse="+"))
                                                    ^

R/helpers.R:51:61: style: Put spaces around all infix operators.

formTab <- paste(weights,"~",paste(c(period,vars),collapse="+"))
                                                           ~^~

R/helpers.R:52:28: style: Commas should always have a space after.

varsTab <- xtabs(formTab,data=dat)
                           ^

R/helpers.R:52:32: style: Put spaces around all infix operators.

varsTab <- xtabs(formTab,data=dat)
                              ~^~

R/helpers.R:87:61: style: There should be a space between right parenthesis and an opening curly brace.

quantileNA <- function(x, probs, p.names, np = length(probs)){
                                                            ^~

R/helpers.R:98:38: style: There should be a space between right parenthesis and an opening curly brace.

randomInsert <- function(x, y, n = 20){
                                     ^~

R/helpers.R:109:41: style: Commas should always have a space after.

generateRandomName <- function(nchar=20,existingNames){
                                        ^

R/helpers.R:109:54: style: There should be a space between right parenthesis and an opening curly brace.

generateRandomName <- function(nchar=20,existingNames){
                                                     ^~

R/helpers.R:110:1: style: Trailing whitespace is superfluous.

^~

R/helpers.R:111:37: style: Commas should always have a space after.

newName <- paste(sample(c(letters,LETTERS),nchar),collapse="")
                                    ^

R/helpers.R:111:46: style: Commas should always have a space after.

newName <- paste(sample(c(letters,LETTERS),nchar),collapse="")
                                             ^

R/helpers.R:111:53: style: Commas should always have a space after.

newName <- paste(sample(c(letters,LETTERS),nchar),collapse="")
                                                    ^

R/helpers.R:111:61: style: Put spaces around all infix operators.

newName <- paste(sample(c(letters,LETTERS),nchar),collapse="")
                                                           ~^~

R/helpers.R:112:8: style: Place a space before left parenthesis, except in a function call.

while(newName%in%existingNames){
       ^

R/helpers.R:112:16: style: Put spaces around all infix operators.

while(newName%in%existingNames){
              ~^~~~~

R/helpers.R:112:33: style: There should be a space between right parenthesis and an opening curly brace.

while(newName%in%existingNames){
                                ^~

R/helpers.R:113:39: style: Commas should always have a space after.

newName <- paste(sample(c(letters,LETTERS),nchar),collapse="")
                                      ^

R/helpers.R:113:48: style: Commas should always have a space after.

newName <- paste(sample(c(letters,LETTERS),nchar),collapse="")
                                               ^

R/helpers.R:113:55: style: Commas should always have a space after.

newName <- paste(sample(c(letters,LETTERS),nchar),collapse="")
                                                      ^

R/helpers.R:113:63: style: Put spaces around all infix operators.

newName <- paste(sample(c(letters,LETTERS),nchar),collapse="")
                                                             ~^~

R/helpers.R:116:1: style: Trailing whitespace is superfluous.

^~

R/ipf.r:11:15: warning: Avoid 1:nrow(...) expressions, use seq_len.

x$ID_ipu <- 1:nrow(x)
              ^

R/ipf.r:13:29: warning: Avoid 1:length(...) expressions, use seq_len.

factor(x$ID_ipu, levels = 1:length(targets))
                            ^

R/ipf.r:24:41: style: There should be a space between right parenthesis and an opening curly brace.

none = function(x, w){
                                        ^~

R/ipf.r:45:25: style: There should be a space between right parenthesis and an opening curly brace.

kishFactor <- function(w){
                        ^~

R/ipf.r:52:43: style: There should be a space between right parenthesis and an opening curly brace.

boundsFak <- function(g1, g0, f, bound = 4){
                                          ^~

R/ipf.r:63:56: style: There should be a space between right parenthesis and an opening curly brace.

boundsFakHH <- function(g1, g0, eps, orig, p, bound = 4){
                                                       ^~

R/ipf.r:132:15: style: Variable and function names should not be longer than 30 characters.

wValue <- representativeHouseholdForCalibration <- NULL
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/ipf.r:178:17: style: Put spaces around all infix operators.

epsP=head(epsPcur, 1),
               ~^~

R/ipf.r:180:17: style: Place a space before left parenthesis, except in a function call.

if(!is.null(numericalWeightingVar)){
                ^

R/ipf.r:180:49: style: There should be a space between right parenthesis and an opening curly brace.

if(!is.null(numericalWeightingVar)){
                                                ^~

R/ipf.r:181:1: style: Lines should not be more than 80 characters.

​                sum(get(variableKeepingTheCalibWeight)*get(numericalWeightingVar))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/ipf.r:181:55: style: Put spaces around all infix operators.

​                sum(get(variableKeepingTheCalibWeight)*get(numericalWeightingVar))
                                                     ~^~

R/ipf.r:186:22: style: Put spaces around all infix operators.

PopMargin=head(value, 1)),
                    ~^~

R/ipf.r:188:1: style: Trailing whitespace is superfluous.

^~~~~~~~

R/ipf.r:189:1: style: Trailing whitespace is superfluous.

^~~~~~~~

R/ipf.r:222:24: style: Variable and function names should not be longer than 30 characters.

value <- wValue <- representativeHouseholdForCalibration <- NULL
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/ipf.r:329:3: style: Variable and function names should not be longer than 30 characters.

representativeHouseholdForCalibration <- OriginalSortingVariable <-
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/ipf.r:335:37: style: There should be a space between right parenthesis and an opening curly brace.

if ((maxIter < calIter) & returnNA){
                                    ^~

R/ipf.r:381:1: style: Lines should not be more than 80 characters.

#' [here](http://www.ajs.or.at/index.php/ajs/article/viewFile/doi10.17713ajs.v45i3.120/512).
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/ipf.r:389:1: style: Lines should not be more than 80 characters.

#' \out{\deqn{1-epsP < \frac{w_{i+1}}{w_i} < 1+epsP}{1-epsP < w(i+1)/w(i) < 1+epsP} }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/ipf.r:535:1: style: functions should have cyclomatic complexity of less than 15, this has 74.

ipf <- function(
^

R/ipf.r:552:24: style: Variable and function names should not be longer than 30 characters.

value <- wValue <- representativeHouseholdForCalibration <- ..hid <- NULL
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/ipf.r:577:28: warning: Avoid 1:nrow(...) expressions, use seq_len.

dat[, hid := as.factor(1:nrow(dat))]
                           ^

R/ipf.r:578:11: style: Variable and function names should not be longer than 30 characters.

dat[, representativeHouseholdForCalibration := 1]
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/ipf.r:582:11: style: Variable and function names should not be longer than 30 characters.

dat[, representativeHouseholdForCalibration :=
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/ipf.r:590:28: style: There should be a space between right parenthesis and an opening curly brace.

for (i in seq_along(conP)){
                           ^~

R/ipf.r:593:37: style: There should be a space between right parenthesis and an opening curly brace.

for (colname in current_colnames){
                                    ^~

R/ipf.r:594:46: style: There should be a space between right parenthesis and an opening curly brace.

if (!inherits(dat[[colname]], "factor")){
                                             ^~

R/ipf.r:662:25: style: There should be a space between right parenthesis and an opening curly brace.

for (hh in hColNames){
                        ^~

R/ipf.r:783:45: style: There should be a space between right parenthesis and an opening curly brace.

​    } else if (verbose && maxIter == calIter){
                                            ^~

R/plot.R:69:1: style: functions should have cyclomatic complexity of less than 15, this has 26.

plot.surveysd <- function(
^

R/plot.R:398:54: style: There should be a space between right parenthesis and an opening curly brace.

define_type <- function(plot.x, x, variable = "HX080"){
                                                     ^~

R/plot.R:424:30: style: There should be a space between right parenthesis and an opening curly brace.

convert_factors <- function(x){
                             ^~

R/recalib.R:44:1: style: Lines should not be more than 80 characters.

#'   weights should be calibrated or a list of such character vectors. Contingency tables for the population are
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:47:1: style: Lines should not be more than 80 characters.

#'   which weights should be calibrated or a list of such character vectors. Contingency tables for the population
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:49:1: style: Lines should not be more than 80 characters.

#' @param epsP numeric value specifying the convergence limit for `conP.var` or `conP`, see [ipf()].
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:50:1: style: Lines should not be more than 80 characters.

#' @param epsH numeric value specifying the convergence limit for `conH.var` or `conH`, see [ipf()].
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:83:3: style: Trailing whitespace is superfluous.

#' 
  ^

R/recalib.R:84:40: style: Trailing whitespace is superfluous.

#' # supply contingency tables directly                           
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:86:1: style: Lines should not be more than 80 characters.

#' conH <- xtabs(pWeight ~ hsize + region + year, data = eusilc[!duplicated(paste(db030,year))])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:89:1: style: Lines should not be more than 80 characters.

#'                           conH = list(conH), verbose = TRUE)                           
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:89:64: style: Trailing whitespace is superfluous.

#'                           conH = list(conH), verbose = TRUE)                           
                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:95:1: style: functions should have cyclomatic complexity of less than 15, this has 48.

recalib <- function(
^

R/recalib.R:168:49: style: Put spaces around all infix operators.

ipfDefaults <- ipfDefaults[!names(ipfDefaults)%in%names(formals(recalib))]
                                               ~^~~~~

R/recalib.R:171:63: style: Trailing whitespace is superfluous.

ellipsis[["check_hh_vars"]] <- getEllipsis2("check_hh_vars", 
                                                              ^

R/recalib.R:173:75: style: Trailing whitespace is superfluous.

ellipsis[["conversion_messages"]] <- getEllipsis2("conversion_messages", 
                                                                          ^

R/recalib.R:174:3: warning: local variable ‘new_id’ assigned but may not be used

new_id <- paste(c(hid, period), collapse = ",")
  ^~~~~~

R/recalib.R:176:41: style: Commas should always have a space after.

ellipsis <- lapply(names(ipfDefaults),function(z){
                                        ^

R/recalib.R:176:51: style: There should be a space between right parenthesis and an opening curly brace.

ellipsis <- lapply(names(ipfDefaults),function(z){
                                                  ^~

R/recalib.R:177:20: style: Commas should always have a space after.

​    getEllipsis2(z,ipfDefaults[[z]],ellipsis)
                   ^

R/recalib.R:177:37: style: Commas should always have a space after.

​    getEllipsis2(z,ipfDefaults[[z]],ellipsis)
                                    ^

R/recalib.R:180:1: style: Trailing whitespace is superfluous.

^

R/recalib.R:182:43: style: Commas should always have a space after.

ellipsisContent <- paste0("ellipsis[['",ellipsisNames,"']]")
                                          ^

R/recalib.R:182:57: style: Commas should always have a space after.

ellipsisContent <- paste0("ellipsis[['",ellipsisNames,"']]")
                                                        ^

R/recalib.R:189:28: style: Commas should always have a space after.

conPnames <- lapply(conP,function(z){
                           ^

R/recalib.R:189:38: style: There should be a space between right parenthesis and an opening curly brace.

conPnames <- lapply(conP,function(z){
                                     ^~

R/recalib.R:191:8: style: Put spaces around all infix operators.

z[z!=period]
      ~^~~

R/recalib.R:193:28: style: Commas should always have a space after.

conHnames <- lapply(conH,function(z){
                           ^

R/recalib.R:193:38: style: There should be a space between right parenthesis and an opening curly brace.

conHnames <- lapply(conH,function(z){
                                     ^~

R/recalib.R:195:8: style: Put spaces around all infix operators.

z[z!=period]
      ~^~~

R/recalib.R:204:1: style: Trailing whitespace is superfluous.

^~

R/recalib.R:205:1: style: Trailing whitespace is superfluous.

^~

R/recalib.R:206:1: style: Lines should not be more than 80 characters.

if (!is.null(conH.var) | !is.null(conP.var) | !is.null(conP) | !is.null(conH)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:213:47: style: Commas should always have a space after.

​      ), .SDcols = c(unique(unlist(c(conH.var,conP.var,
                                              ^

R/recalib.R:214:48: style: Commas should always have a space after.

conPnames,conHnames))))])
                                               ^

R/recalib.R:223:1: style: Trailing whitespace is superfluous.

^~

R/recalib.R:224:1: style: Trailing whitespace is superfluous.

^~

R/recalib.R:229:46: style: Commas should always have a space after.

vars <- c(period, unique(unlist(c(conP.var,conH.var,conPnames,conHnames))))
                                             ^

R/recalib.R:229:55: style: Commas should always have a space after.

vars <- c(period, unique(unlist(c(conP.var,conH.var,conPnames,conHnames))))
                                                      ^

R/recalib.R:229:65: style: Commas should always have a space after.

vars <- c(period, unique(unlist(c(conP.var,conH.var,conPnames,conHnames))))
                                                                ^

R/recalib.R:232:33: style: There should be a space between right parenthesis and an opening curly brace.

if (z.class[1] == "labelled"){
                                ^~

R/recalib.R:238:13: warning: Avoid 1:length(...) expressions, use seq_len.

for (i in 1:length(vars)) {
            ^

R/recalib.R:246:6: style: Place a space before left parenthesis, except in a function call.

for(p in seq_along(conP.var)){
     ^

R/recalib.R:246:31: style: There should be a space between right parenthesis and an opening curly brace.

for(p in seq_along(conP.var)){
                              ^~

R/recalib.R:247:34: style: Commas should always have a space after.

existTab <- sapply(conPnames,setequal,y=conP.var[[p]])
                                 ^

R/recalib.R:247:43: style: Commas should always have a space after.

existTab <- sapply(conPnames,setequal,y=conP.var[[p]])
                                          ^

R/recalib.R:247:44: style: Put spaces around all infix operators.

existTab <- sapply(conPnames,setequal,y=conP.var[[p]])
                                          ~^~

R/recalib.R:248:7: style: Place a space before left parenthesis, except in a function call.

if(all(!existTab)){
      ^

R/recalib.R:248:22: style: There should be a space between right parenthesis and an opening curly brace.

if(all(!existTab)){
                     ^~

R/recalib.R:249:32: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,conP.var[[p]]),collapse="+"))
                               ^

R/recalib.R:249:36: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,conP.var[[p]]),collapse="+"))
                                   ^

R/recalib.R:249:51: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,conP.var[[p]]),collapse="+"))
                                                  ^

R/recalib.R:249:66: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,conP.var[[p]]),collapse="+"))
                                                                 ^

R/recalib.R:249:74: style: Put spaces around all infix operators.

formTab <- paste(weights,"~",paste(c(period,conP.var[[p]]),collapse="+"))
                                                                        ~^~

R/recalib.R:250:22: style: Commas should always have a space after.

conP <- c(conP,list(xtabs(formTab,data=dat)))
                     ^

R/recalib.R:250:41: style: Commas should always have a space after.

conP <- c(conP,list(xtabs(formTab,data=dat)))
                                        ^

R/recalib.R:250:45: style: Put spaces around all infix operators.

conP <- c(conP,list(xtabs(formTab,data=dat)))
                                           ~^~

R/recalib.R:252:1: style: Lines should not be more than 80 characters.

​      stop("contingency table for ",paste(conP.var[p],collapse = ", ")," was supplied through paramter conP AND conP.var")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:252:37: style: Commas should always have a space after.

​      stop("contingency table for ",paste(conP.var[p],collapse = ", ")," was supplied through paramter conP AND conP.var")
                                    ^

R/recalib.R:252:55: style: Commas should always have a space after.

​      stop("contingency table for ",paste(conP.var[p],collapse = ", ")," was supplied through paramter conP AND conP.var")
                                                      ^

R/recalib.R:252:72: style: Commas should always have a space after.

​      stop("contingency table for ",paste(conP.var[p],collapse = ", ")," was supplied through paramter conP AND conP.var")
                                                                       ^

R/recalib.R:253:6: style: Trailing whitespace is superfluous.

​    } 
     ^

R/recalib.R:255:1: style: Trailing whitespace is superfluous.

^~

R/recalib.R:256:8: style: Commas should always have a space after.

dat[,FirstPersonInHousehold_:=c(1L,rep(0,.N-1)),by=c(hid,period)]
       ^

R/recalib.R:256:31: style: Put spaces around all infix operators.

dat[,FirstPersonInHousehold_:=c(1L,rep(0,.N-1)),by=c(hid,period)]
                             ~^~~

R/recalib.R:256:38: style: Commas should always have a space after.

dat[,FirstPersonInHousehold_:=c(1L,rep(0,.N-1)),by=c(hid,period)]
                                     ^

R/recalib.R:256:44: style: Commas should always have a space after.

dat[,FirstPersonInHousehold_:=c(1L,rep(0,.N-1)),by=c(hid,period)]
                                           ^

R/recalib.R:256:46: style: Put spaces around all infix operators.

dat[,FirstPersonInHousehold_:=c(1L,rep(0,.N-1)),by=c(hid,period)]
                                            ~^~

R/recalib.R:256:51: style: Commas should always have a space after.

dat[,FirstPersonInHousehold_:=c(1L,rep(0,.N-1)),by=c(hid,period)]
                                                  ^

R/recalib.R:256:53: style: Put spaces around all infix operators.

dat[,FirstPersonInHousehold_:=c(1L,rep(0,.N-1)),by=c(hid,period)]
                                                   ~^~

R/recalib.R:256:60: style: Commas should always have a space after.

dat[,FirstPersonInHousehold_:=c(1L,rep(0,.N-1)),by=c(hid,period)]
                                                           ^

R/recalib.R:257:6: style: Place a space before left parenthesis, except in a function call.

for(h in seq_along(conH.var)){
     ^

R/recalib.R:257:31: style: There should be a space between right parenthesis and an opening curly brace.

for(h in seq_along(conH.var)){
                              ^~

R/recalib.R:258:34: style: Commas should always have a space after.

existTab <- sapply(conHnames,setequal,y=conH.var[[h]])
                                 ^

R/recalib.R:258:43: style: Commas should always have a space after.

existTab <- sapply(conHnames,setequal,y=conH.var[[h]])
                                          ^

R/recalib.R:258:44: style: Put spaces around all infix operators.

existTab <- sapply(conHnames,setequal,y=conH.var[[h]])
                                          ~^~

R/recalib.R:259:7: style: Place a space before left parenthesis, except in a function call.

if(all(!existTab)){
      ^

R/recalib.R:259:22: style: There should be a space between right parenthesis and an opening curly brace.

if(all(!existTab)){
                     ^~

R/recalib.R:260:32: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,conH.var[[h]]),collapse="+"))
                               ^

R/recalib.R:260:36: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,conH.var[[h]]),collapse="+"))
                                   ^

R/recalib.R:260:51: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,conH.var[[h]]),collapse="+"))
                                                  ^

R/recalib.R:260:66: style: Commas should always have a space after.

formTab <- paste(weights,"~",paste(c(period,conH.var[[h]]),collapse="+"))
                                                                 ^

R/recalib.R:260:74: style: Put spaces around all infix operators.

formTab <- paste(weights,"~",paste(c(period,conH.var[[h]]),collapse="+"))
                                                                        ~^~

R/recalib.R:261:22: style: Commas should always have a space after.

conH <- c(conH,list(xtabs(formTab,data=dat[FirstPersonInHousehold_==1])))
                     ^

R/recalib.R:261:41: style: Commas should always have a space after.

conH <- c(conH,list(xtabs(formTab,data=dat[FirstPersonInHousehold_==1])))
                                        ^

R/recalib.R:261:45: style: Put spaces around all infix operators.

conH <- c(conH,list(xtabs(formTab,data=dat[FirstPersonInHousehold_==1])))
                                           ~^~

R/recalib.R:261:73: style: Put spaces around all infix operators.

conH <- c(conH,list(xtabs(formTab,data=dat[FirstPersonInHousehold_==1])))
                                                                       ~^~~

R/recalib.R:263:1: style: Lines should not be more than 80 characters.

​      stop("contingency table for ",paste(conH.var[[h]],collapse = ", ")," was supplied through paramter conH AND conH.var")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:263:37: style: Commas should always have a space after.

​      stop("contingency table for ",paste(conH.var[[h]],collapse = ", ")," was supplied through paramter conH AND conH.var")
                                    ^

R/recalib.R:263:57: style: Commas should always have a space after.

​      stop("contingency table for ",paste(conH.var[[h]],collapse = ", ")," was supplied through paramter conH AND conH.var")
                                                        ^

R/recalib.R:263:74: style: Commas should always have a space after.

​      stop("contingency table for ",paste(conH.var[[h]],collapse = ", ")," was supplied through paramter conH AND conH.var")
                                                                         ^

R/recalib.R:264:6: style: Trailing whitespace is superfluous.

​    } 
     ^

R/recalib.R:266:1: style: Trailing whitespace is superfluous.

^

R/recalib.R:269:8: style: Commas should always have a space after.

dat[,hidfactor:=factor(do.call(paste0,.SD)), .SDcols=c(hid,period)]
       ^

R/recalib.R:269:17: style: Put spaces around all infix operators.

dat[,hidfactor:=factor(do.call(paste0,.SD)), .SDcols=c(hid,period)]
               ~^~~

R/recalib.R:269:41: style: Commas should always have a space after.

dat[,hidfactor:=factor(do.call(paste0,.SD)), .SDcols=c(hid,period)]
                                        ^

R/recalib.R:269:55: style: Put spaces around all infix operators.

dat[,hidfactor:=factor(do.call(paste0,.SD)), .SDcols=c(hid,period)]
                                                     ~^~

R/recalib.R:269:62: style: Commas should always have a space after.

dat[,hidfactor:=factor(do.call(paste0,.SD)), .SDcols=c(hid,period)]
                                                             ^

R/recalib.R:272:1: style: Lines should not be more than 80 characters.

select.var <- unique(c("hidfactor", weights, period, unlist(c(conP.var,conH.var,conPnames,conHnames))))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/recalib.R:272:74: style: Commas should always have a space after.

select.var <- unique(c("hidfactor", weights, period, unlist(c(conP.var,conH.var,conPnames,conHnames))))
                                                                         ^

R/recalib.R:272:83: style: Commas should always have a space after.

select.var <- unique(c("hidfactor", weights, period, unlist(c(conP.var,conH.var,conPnames,conHnames))))
                                                                                  ^
Please sign in to comment.
You can’t perform that action at this time.