Skip to content

Commit

Permalink
code style: change to only use double-quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
stewid committed Nov 2, 2019
1 parent 52be0ce commit d02e20c
Showing 1 changed file with 58 additions and 60 deletions.
118 changes: 58 additions & 60 deletions R/trace.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
##' @param tol Tolerance of the check
##' @return logical vector
##' @keywords internal
is_wholenumber <- function(x, tol = .Machine$double.eps^0.5)
{
is_wholenumber <- function(x, tol = .Machine$double.eps^0.5) {
abs(x - round(x)) < tol
}

Expand Down Expand Up @@ -173,21 +172,20 @@ Trace <- function(movements,
inEnd = NULL,
outBegin = NULL,
outEnd = NULL,
maxDistance = NULL)
{
maxDistance = NULL) {
## Before doing any contact tracing check that arguments are ok
## from various perspectives.
if (any(missing(movements),
missing(root))) {
stop('Missing parameters in call to Trace')
stop("Missing parameters in call to Trace")
}

if (!is.data.frame(movements)) {
stop('movements must be a data.frame')
stop("movements must be a data.frame")
}

if (!all(c('source', 'destination', 't') %in% names(movements))) {
stop('movements must contain the columns source, destination and t.')
if (!all(c("source", "destination", "t") %in% names(movements))) {
stop("movements must contain the columns source, destination and t.")
}

##
Expand All @@ -196,11 +194,11 @@ Trace <- function(movements,
if (any(is.factor(movements$source), is.integer(movements$source))) {
movements$source <- as.character(movements$source)
} else if (!is.character(movements$source)) {
stop('invalid class of column source in movements')
stop("invalid class of column source in movements")
}

if (any(is.na(movements$source))) {
stop('source in movements contains NA')
stop("source in movements contains NA")
}

##
Expand All @@ -209,11 +207,11 @@ Trace <- function(movements,
if (any(is.factor(movements$destination), is.integer(movements$destination))) {
movements$destination <- as.character(movements$destination)
} else if (!is.character(movements$destination)) {
stop('invalid class of column destination in movements')
stop("invalid class of column destination in movements")
}

if (any(is.na(movements$destination))) {
stop('destination in movements contains NA')
stop("destination in movements contains NA")
}

##
Expand All @@ -222,57 +220,57 @@ Trace <- function(movements,
if (any(is.character(movements$t), is.factor(movements$t))) {
movements$t <- as.Date(movements$t)
}
if (!identical(class(movements$t), 'Date')) {
stop('invalid class of column t in movements')
if (!identical(class(movements$t), "Date")) {
stop("invalid class of column t in movements")
}

if (any(is.na(movements$t))) {
stop('t in movements contains NA')
stop("t in movements contains NA")
}

if ('n' %in% names(movements)) {
if ("n" %in% names(movements)) {
if (is.integer(movements$n)) {
movements$n <- as.numeric(movements$n)
} else if (!is.numeric(movements$n)) {
stop('invalid class of column n in movements')
stop("invalid class of column n in movements")
}
} else {
movements$n <- as.numeric(NA)
}

if ('id' %in% names(movements)) {
if ("id" %in% names(movements)) {
if (any(is.factor(movements$id), is.integer(movements$id))) {
movements$id <- as.character(movements$id)
} else if (!is.character(movements$id)) {
stop('invalid class of column id in movements')
stop("invalid class of column id in movements")
}
} else {
movements$id <- as.character(NA)
}

if ('category' %in% names(movements)) {
if ("category" %in% names(movements)) {
if (any(is.factor(movements$category), is.integer(movements$category))) {
movements$category <- as.character(movements$category)
} else if (!is.character(movements$category)) {
stop('invalid class of column category in movements')
stop("invalid class of column category in movements")
}
} else {
movements$category <- as.character(NA)
}

## Make sure the columns are in expected order
if (!identical(names(movements), c('source',
'destination',
't',
'id',
'n',
'category'))) {
movements <- movements[, c('source',
'destination',
't',
'id',
'n',
'category')]
if (!identical(names(movements), c("source",
"destination",
"t",
"id",
"n",
"category"))) {
movements <- movements[, c("source",
"destination",
"t",
"id",
"n",
"category")]
}

## Make sure that no duplicate movements exists
Expand All @@ -293,11 +291,11 @@ Trace <- function(movements,

root <- as.character(rootr)
} else if (!is.character(root)) {
stop('invalid class of root')
stop("invalid class of root")
}

if (any(is.na(root))) {
stop('root contains NA')
stop("root contains NA")
}

## Check if we are using the combination of tEnd and days or
Expand All @@ -306,14 +304,14 @@ Trace <- function(movements,
## Using tEnd and days...check that
## inBegin, inEnd, outBegin and outEnd is NULL
if (!all(is.null(inBegin), is.null(inEnd), is.null(outBegin), is.null(outEnd))) {
stop('Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to Trace')
stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to Trace")
}

if (any(is.character(tEnd), is.factor(tEnd))) {
tEnd <- as.Date(tEnd)
}

if (!identical(class(tEnd), 'Date')) {
if (!identical(class(tEnd), "Date")) {
stop("'tEnd' must be a Date vector")
}

Expand Down Expand Up @@ -344,10 +342,10 @@ Trace <- function(movements,
## Using inBegin, inEnd, outBegin and outEnd...check that
## tEnd and days are NULL
if (!all(is.null(tEnd), is.null(days))) {
stop('Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to Trace')
stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to Trace")
}
} else {
stop('Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to Trace')
stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to Trace")
}

##
Expand All @@ -357,12 +355,12 @@ Trace <- function(movements,
inBegin <- as.Date(inBegin)
}

if (!identical(class(inBegin), 'Date')) {
if (!identical(class(inBegin), "Date")) {
stop("'inBegin' must be a Date vector")
}

if (any(is.na(inBegin))) {
stop('inBegin contains NA')
stop("inBegin contains NA")
}

##
Expand All @@ -372,12 +370,12 @@ Trace <- function(movements,
inEnd <- as.Date(inEnd)
}

if (!identical(class(inEnd), 'Date')) {
if (!identical(class(inEnd), "Date")) {
stop("'inEnd' must be a Date vector")
}

if (any(is.na(inEnd))) {
stop('inEnd contains NA')
stop("inEnd contains NA")
}

##
Expand All @@ -387,12 +385,12 @@ Trace <- function(movements,
outBegin <- as.Date(outBegin)
}

if (!identical(class(outBegin), 'Date')) {
if (!identical(class(outBegin), "Date")) {
stop("'outBegin' must be a Date vector")
}

if (any(is.na(outBegin))) {
stop('outBegin contains NA')
stop("outBegin contains NA")
}

##
Expand All @@ -402,35 +400,35 @@ Trace <- function(movements,
outEnd <- as.Date(outEnd)
}

if (!identical(class(outEnd), 'Date')) {
if (!identical(class(outEnd), "Date")) {
stop("'outEnd' must be a Date vector")
}

if (any(is.na(outEnd))) {
stop('outEnd contains NA')
stop("outEnd contains NA")
}

##
## Check ranges of dates
##
if (any(inEnd < inBegin)) {
stop('inEnd < inBegin')
stop("inEnd < inBegin")
}

if (any(outEnd < outBegin)) {
stop('outEnd < outBegin')
stop("outEnd < outBegin")
}

##
## Check length of vectors
##
if (!identical(length(unique(c(length(root),
length(inBegin),
length(inEnd),
length(outBegin),
length(outEnd)))),
1L)) {
stop('root, inBegin, inEnd, outBegin and outEnd must have equal length')
length(inBegin),
length(inEnd),
length(outBegin),
length(outEnd)))),
1L)) {
stop("root, inBegin, inEnd, outBegin and outEnd must have equal length")
}

##
Expand Down Expand Up @@ -486,7 +484,7 @@ Trace <- function(movements,
index <- match(apply(contacts_all, 1, function(x) paste(x, collapse="\r")),
apply(contacts, 1, function(x) paste(x, collapse="\r")))

ingoingContacts <- new('Contacts',
ingoingContacts <- new("Contacts",
root = root[i],
tBegin = inBegin[i],
tEnd = inEnd[i],
Expand All @@ -498,7 +496,7 @@ Trace <- function(movements,
category = contacts[,6],
index = index,
distance = distance,
direction = 'in')
direction = "in")

## Extract data from contact tracing
contacts_all <- movements[trace_contacts[[j + 3]], ]
Expand All @@ -514,7 +512,7 @@ Trace <- function(movements,
index <- match(apply(contacts_all, 1, function(x) paste(x, collapse="\r")),
apply(contacts, 1, function(x) paste(x, collapse="\r")))

outgoingContacts <- new('Contacts',
outgoingContacts <- new("Contacts",
root = root[i],
tBegin = outBegin[i],
tEnd = outEnd[i],
Expand All @@ -526,9 +524,9 @@ Trace <- function(movements,
category = contacts[,6],
index = index,
distance = distance,
direction = 'out')
direction = "out")

return(new('ContactTrace',
return(new("ContactTrace",
root = root[i],
ingoingContacts = ingoingContacts,
outgoingContacts = outgoingContacts))
Expand Down

1 comment on commit d02e20c

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/ingoing-contact-chain.R:189:46: style: Commas should always have a space after.

return(length(setdiff(x@source,x@root)))
                                             ^

R/network-structure.R:135:1: style: Lines should not be more than 80 characters.

i <- tmp[seq_len(length(tmp) - 1)] != tmp[seq_len(length(tmp))[-1]]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:248:1: style: Lines should not be more than 80 characters.

inDays = as.integer(x@ingoingContacts@tEnd - x@ingoingContacts@tBegin),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:251:1: style: Lines should not be more than 80 characters.

outDays = as.integer(x@outgoingContacts@tEnd - x@outgoingContacts@tBegin),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:254:1: style: Lines should not be more than 80 characters.

ingoingContactChain = IngoingContactChain(x@ingoingContacts),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:255:1: style: Lines should not be more than 80 characters.

outgoingContactChain = OutgoingContactChain(x@outgoingContacts))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:261:1: style: functions should have cyclomatic complexity of less than 15, this has 38.

setMethod("NetworkSummary",
^

R/network-summary.R:315:1: style: Lines should not be more than 80 characters.

## so test that root is a integer the same way as binom.test test x
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:323:20: style: Only use double-quotes.

​              stop('invalid class of root')
                   ^~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:331:1: style: Lines should not be more than 80 characters.

if (!all(is.null(inBegin), is.null(inEnd), is.null(outBegin), is.null(outEnd))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:332:1: style: Lines should not be more than 80 characters.

​                  stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to NetworkSummary")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:343:1: style: Lines should not be more than 80 characters.

## Test that days is a nonnegative integer the same way as binom.test test x
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:345:1: style: Lines should not be more than 80 characters.

if (any(is.na(days) | (days < 0)) || max(abs(days - daysr)) > 1e-07) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:365:1: style: Lines should not be more than 80 characters.

​          } else if (all(!is.null(inBegin), !is.null(inEnd), !is.null(outBegin), !is.null(outEnd))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:370:1: style: Lines should not be more than 80 characters.

​                  stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to NetworkSummary")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:373:1: style: Lines should not be more than 80 characters.

​              stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to NetworkSummary")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:456:1: style: Lines should not be more than 80 characters.

​              stop("root, inBegin, inEnd, outBegin and outEnd must have equal length")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:468:24: style: Put spaces around all infix operators.

contact_chain<- .Call("networkSummary",
                      ~^

R/network-summary.R:469:1: style: Lines should not be more than 80 characters.

​                                as.integer(factor(x$source, levels = levels(nodes))),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:470:1: style: Lines should not be more than 80 characters.

​                                as.integer(factor(x$destination, levels = levels(nodes))),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:472:1: style: Lines should not be more than 80 characters.

​                                as.integer(factor(root, levels = levels(nodes))),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:489:1: style: Lines should not be more than 80 characters.

ingoingContactChain = contact_chain[["ingoingContactChain"]],
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/network-summary.R:490:1: style: Lines should not be more than 80 characters.

outgoingContactChain = contact_chain[["outgoingContactChain"]]))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/out-degree.R:119:1: style: Lines should not be more than 80 characters.

##'     Get the OutDegree for a data.frame with movements, see details and examples.
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/out-degree.R:208:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/outgoing-contact-chain.R:67:1: style: Lines should not be more than 80 characters.

##'     The \code{\link{OutgoingContactChain}} of the root within the time-interval
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/outgoing-contact-chain.R:77:1: style: Lines should not be more than 80 characters.

##'     Get the OutgoingContactChain for a data.frame with movements, see examples.
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/outgoing-contact-chain.R:137:1: style: Lines should not be more than 80 characters.

​                  stop("Unable to determine OutgoingContactChain for ingoing contacts")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/outgoing-contact-chain.R:140:51: style: Commas should always have a space after.

return(length(setdiff(x@destination,x@root)))
                                                  ^

R/outgoing-contact-chain.R:167:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/plot.R:73:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/plot.R:83:1: style: Lines should not be more than 80 characters.

tree$ingoing$bg <- ifelse(tree$ingoing$level > 0, "white", "black")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/plot.R:96:1: style: Lines should not be more than 80 characters.

tree$outgoing$bg <- ifelse(tree$outgoing$level > 0, "gray", "black")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/plot.R:108:64: style: Commas should always have a space after.

vertices <- rbind(vertices, tree$outgoing[-1,])
                                                               ^

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

for(i in seq_len(nrow(contacts))) {
       ^

R/report.R:35:1: style: Lines should not be more than 80 characters.

​                   paste(rep("<td>&nbsp;</td>", 2L * (contacts$distance[i] - 1L)), collapse = ""),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

2L * (max(contacts$distance - 1L) - (contacts$distance[i] - 1L))),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:62:77: style: Commas should always have a space after.

contacts <- contacts[order(contacts$t, contacts$id, decreasing = FALSE),]
                                                                            ^

R/report.R:73:1: style: Lines should not be more than 80 characters.

​    as.character(unlist(by(contacts, sprintf("%s - %s", contacts$lhs, contacts$rhs), function(x) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:78:1: style: Lines should not be more than 80 characters.

​                   sprintf('<h3><a name="%s-%s-%s">%s %s %s</a></h3>', direction,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:81:1: style: Lines should not be more than 80 characters.

"<tr><th>Date</th><th>Id</th><th>N</th><th>Category</th><th>Source</th><th>Destination</th></tr>")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:83:12: style: Place a space before left parenthesis, except in a function call.

for(i in seq_len(nrow(x))) {
           ^

R/report.R:104:1: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​{
^

R/report.R:113:1: style: Lines should not be more than 80 characters.

​               sprintf("<h3 align='center'>Version: %s</h3>", packageVersion("EpiContactTrace")),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

​               sprintf("<tr><td>In begin date:</td><td>%s</td></tr>", x@ingoingContacts@tBegin),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:119:1: style: Lines should not be more than 80 characters.

​               sprintf("<tr><td>In end date:</td><td>%s</td></tr>", x@ingoingContacts@tEnd),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:120:1: style: Lines should not be more than 80 characters.

​               sprintf("<tr><td>In days:</td><td>%i</td></tr>", x@ingoingContacts@tEnd - x@ingoingContacts@tBegin),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:121:1: style: Lines should not be more than 80 characters.

​               sprintf("<tr><td>In degree:</td><td>%i</td></tr>", InDegree(x@ingoingContacts)),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:122:1: style: Lines should not be more than 80 characters.

​               sprintf("<tr><td>Ingoing contact chain:</td><td>%i</td></tr>", IngoingContactChain(x@ingoingContacts)),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:136:1: style: Lines should not be more than 80 characters.

lines <- c(lines, "<p>No ingoing contacts during the search period.</p>")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:144:1: style: Lines should not be more than 80 characters.

​               sprintf("<tr><td>Out begin date:</td><td>%s</td></tr>", x@outgoingContacts@tBegin),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:145:1: style: Lines should not be more than 80 characters.

​               sprintf("<tr><td>Out end date:</td><td>%s</td></tr>", x@outgoingContacts@tEnd),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:146:1: style: Lines should not be more than 80 characters.

​               sprintf("<tr><td>Out days:</td><td>%i</td></tr>", x@outgoingContacts@tEnd - x@outgoingContacts@tBegin),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:147:1: style: Lines should not be more than 80 characters.

​               sprintf("<tr><td>Out degree:</td><td>%i</td></tr>", OutDegree(x@outgoingContacts)),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:148:1: style: Lines should not be more than 80 characters.

​               sprintf("<tr><td>Outgoing contact chain:</td><td>%i</td></tr>", OutgoingContactChain(x@outgoingContacts)),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:162:1: style: Lines should not be more than 80 characters.

lines <- c(lines, "<p>No outgoing contacts during the search period.</p>")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:177:69: style: Commas should always have a space after.

​                   html_detailed_table(df[df$destination == df$root,], "in"))
                                                                    ^

R/report.R:179:44: style: Commas should always have a space after.

df <- df[df$destination != df$root,]
                                           ^

R/report.R:199:53: style: Commas should always have a space after.

​        html_detailed_table(df[df$source == df$root,], "out")
                                                    ^

R/report.R:201:39: style: Commas should always have a space after.

df <- df[df$source != df$root,]
                                      ^

R/report.R:238:1: style: Lines should not be more than 80 characters.

##' available. To generate pdf files a TeX installation must exist to compile the
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:261:1: style: Lines should not be more than 80 characters.

##' @param template the Sweave template file to use. If none is provided, the default
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:333:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/report.R:347:1: style: Lines should not be more than 80 characters.

​              writeLines(html_report(object), con = sprintf("%s.html", object@root))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:350:1: style: Lines should not be more than 80 characters.

template <- system.file("Sweave/speak-latex.rnw", package = "EpiContactTrace")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:353:45: style: Put spaces around all infix operators.

utils::Sweave(template, syntax="SweaveSyntaxNoweb")
                                           ~^~

R/report.R:354:1: style: Lines should not be more than 80 characters.

tools::texi2pdf(sub("rnw$", "tex", basename(template)), clean = TRUE)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:355:1: style: Lines should not be more than 80 characters.

​              file.rename(sub("rnw$", "pdf", basename(template)), sprintf("%s.pdf", object@root))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/report.R:368:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/report.R:403:1: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​{
^

R/shortest-paths.R:137:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/shortest-paths.R:139:44: style: Commas should always have a space after.

ns.in <- ns[ns$direction == "in",]
                                           ^

R/shortest-paths.R:140:46: style: Commas should always have a space after.

ns.out <- ns[ns$direction == "out",]
                                             ^

R/shortest-paths.R:144:66: style: Commas should always have a space after.

ns.in <- ns.in[order(ns.in$distance, ns.in$source),]
                                                                 ^

R/shortest-paths.R:145:56: style: Commas should always have a space after.

ns.in <- ns.in[!duplicated(ns.in$source),]
                                                       ^

R/shortest-paths.R:151:75: style: Commas should always have a space after.

ns.out <- ns.out[order(ns.out$distance, ns.out$destination),]
                                                                          ^

R/shortest-paths.R:152:64: style: Commas should always have a space after.

ns.out <- ns.out[!duplicated(ns.out$destination),]
                                                               ^

R/shortest-paths.R:169:1: style: functions should have cyclomatic complexity of less than 15, this has 41.

setMethod("ShortestPaths",
^

R/shortest-paths.R:179:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/shortest-paths.R:241:1: style: Lines should not be more than 80 characters.

if (!all(is.null(inBegin), is.null(inEnd), is.null(outBegin), is.null(outEnd))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/shortest-paths.R:242:1: style: Lines should not be more than 80 characters.

​                  stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to ShortestPaths")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/shortest-paths.R:256:1: style: Lines should not be more than 80 characters.

if (any(is.na(days) | (days < 0)) || max(abs(days - daysr)) > 1e-07) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/shortest-paths.R:276:1: style: Lines should not be more than 80 characters.

​          } else if (all(!is.null(inBegin), !is.null(inEnd), !is.null(outBegin), !is.null(outEnd))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/shortest-paths.R:281:1: style: Lines should not be more than 80 characters.

​                  stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to ShortestPaths")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/shortest-paths.R:284:1: style: Lines should not be more than 80 characters.

​              stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to ShortestPaths")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/shortest-paths.R:367:1: style: Lines should not be more than 80 characters.

​              stop("root, inBegin, inEnd, outBegin and outEnd must have equal length")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/shortest-paths.R:413:1: style: Lines should not be more than 80 characters.

destination = x$destination[sp$outRowid],
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/show.R:76:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/show.R:88:1: style: Lines should not be more than 80 characters.

​              cat(sprintf("%sgoing contact chain: %i\n\n", prefix, OutgoingContactChain(object)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/show.R:91:1: style: Lines should not be more than 80 characters.

​              cat(sprintf("%sgoing contact chain: %i\n\n", prefix, IngoingContactChain(object)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/show.R:102:1: style: Lines should not be more than 80 characters.

## Rename source and destination to lhs and rhs, with respect to direction
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/show.R:111:18: style: Place a space before left parenthesis, except in a function call.

for(i in seq_len(nrow(ns))) {
                 ^

R/show.R:113:1: style: Lines should not be more than 80 characters.

​                              paste(rep(" ", (ns$distance[i] - 1) * (width + 5)), collapse=""),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/show.R:113:91: style: Put spaces around all infix operators.

​                              paste(rep(" ", (ns$distance[i] - 1) * (width + 5)), collapse=""),
                                                                                         ~^~

R/show.R:119:1: style: Lines should not be more than 80 characters.

​              cat(sprintf("No %sgoing contacts during the search period.\n", object@direction))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:167:1: style: functions should have cyclomatic complexity of less than 15, this has 56.

Trace <- function(movements,
^

R/trace.R:207:1: style: Lines should not be more than 80 characters.

if (any(is.factor(movements$destination), is.integer(movements$destination))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

if (any(is.factor(movements$category), is.integer(movements$category))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:306:1: style: Lines should not be more than 80 characters.

if (!all(is.null(inBegin), is.null(inEnd), is.null(outBegin), is.null(outEnd))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:307:1: style: Lines should not be more than 80 characters.

​            stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to Trace")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:318:1: style: Lines should not be more than 80 characters.

## Test that days is a nonnegative integer the same way as binom.test test x
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:335:31: style: Put spaces around all infix operators.

root <- rep(root, each=n.tEnd*n.days, length.out=n)
                             ~^~

R/trace.R:335:38: style: Put spaces around all infix operators.

root <- rep(root, each=n.tEnd*n.days, length.out=n)
                                    ~^~

R/trace.R:335:57: style: Put spaces around all infix operators.

root <- rep(root, each=n.tEnd*n.days, length.out=n)
                                                       ~^~

R/trace.R:336:32: style: Put spaces around all infix operators.

inEnd <- rep(tEnd, each=n.days, length.out=n)
                              ~^~

R/trace.R:336:51: style: Put spaces around all infix operators.

inEnd <- rep(tEnd, each=n.days, length.out=n)
                                                 ~^~

R/trace.R:337:42: style: Put spaces around all infix operators.

inBegin <- inEnd - rep(days, each=1, length.out=n)
                                        ~^~

R/trace.R:337:56: style: Put spaces around all infix operators.

inBegin <- inEnd - rep(days, each=1, length.out=n)
                                                      ~^~

R/trace.R:340:1: style: Lines should not be more than 80 characters.

​    } else if (all(!is.null(inBegin), !is.null(inEnd), !is.null(outBegin), !is.null(outEnd))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:345:1: style: Lines should not be more than 80 characters.

​            stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to Trace")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:348:1: style: Lines should not be more than 80 characters.

​        stop("Use either tEnd and days or inBegin, inEnd, outBegin and outEnd in call to Trace")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:458:1: style: Lines should not be more than 80 characters.

​                            as.integer(factor(movements$source, levels=levels(nodes))),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:458:71: style: Put spaces around all infix operators.

​                            as.integer(factor(movements$source, levels=levels(nodes))),
                                                                     ~^~

R/trace.R:459:1: style: Lines should not be more than 80 characters.

​                            as.integer(factor(movements$destination, levels=levels(nodes))),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:459:76: style: Put spaces around all infix operators.

​                            as.integer(factor(movements$destination, levels=levels(nodes))),
                                                                          ~^~

R/trace.R:461:59: style: Put spaces around all infix operators.

​                            as.integer(factor(root, levels=levels(nodes))),
                                                         ~^~

R/trace.R:471:16: style: Put spaces around all infix operators.

j <- (i-1) * 4
              ~^~

R/trace.R:481:1: style: Lines should not be more than 80 characters.

## Create an index to contacts, so that the result matrix can be reconstructed
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:483:12: style: Commented code should be removed.

## contacts_all <- cbind(contacts[index,], distance)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:484:1: style: Lines should not be more than 80 characters.

index <- match(apply(contacts_all, 1, function(x) paste(x, collapse="\r")),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:484:76: style: Put spaces around all infix operators.

index <- match(apply(contacts_all, 1, function(x) paste(x, collapse="\r")),
                                                                          ~^~

R/trace.R:485:72: style: Put spaces around all infix operators.

​                       apply(contacts, 1, function(x) paste(x, collapse="\r")))
                                                                      ~^~

R/trace.R:491:51: style: Commas should always have a space after.

source = contacts[,1],
                                                  ^

R/trace.R:492:56: style: Commas should always have a space after.

destination = contacts[,2],
                                                       ^

R/trace.R:493:46: style: Commas should always have a space after.

t = contacts[,3],
                                             ^

R/trace.R:494:47: style: Commas should always have a space after.

id = contacts[,4],
                                              ^

R/trace.R:495:46: style: Commas should always have a space after.

n = contacts[,5],
                                             ^

R/trace.R:496:53: style: Commas should always have a space after.

category = contacts[,6],
                                                    ^

R/trace.R:509:1: style: Lines should not be more than 80 characters.

## Create an index to contacts, so that the result matrix can be reconstructed
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:511:12: style: Commented code should be removed.

## contacts_all <- cbind(contacts[index,], distance)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:512:1: style: Lines should not be more than 80 characters.

index <- match(apply(contacts_all, 1, function(x) paste(x, collapse="\r")),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:512:76: style: Put spaces around all infix operators.

index <- match(apply(contacts_all, 1, function(x) paste(x, collapse="\r")),
                                                                          ~^~

R/trace.R:513:72: style: Put spaces around all infix operators.

​                       apply(contacts, 1, function(x) paste(x, collapse="\r")))
                                                                      ~^~

R/trace.R:519:52: style: Commas should always have a space after.

source = contacts[,1],
                                                   ^

R/trace.R:520:57: style: Commas should always have a space after.

destination = contacts[,2],
                                                        ^

R/trace.R:521:47: style: Commas should always have a space after.

t = contacts[,3],
                                              ^

R/trace.R:522:48: style: Commas should always have a space after.

id = contacts[,4],
                                               ^

R/trace.R:523:47: style: Commas should always have a space after.

n = contacts[,5],
                                              ^

R/trace.R:524:54: style: Commas should always have a space after.

category = contacts[,6],
                                                     ^

R/trace.R:535:1: style: Lines should not be more than 80 characters.

## Name each list item with ContactTrace objects to the name of the ContactTrace root.
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/trace.R:536:1: style: Lines should not be more than 80 characters.

​    names(result) <-  sapply(result, function(listItem) listItem@ingoingContacts@root)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/tree.R:31:1: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​{
^

R/tree.R:36:70: style: Commas should always have a space after.

tree.in <- network_structure[network_structure$direction == "in",]
                                                                     ^

R/tree.R:37:72: style: Commas should always have a space after.

tree.out <- network_structure[network_structure$direction == "out",]
                                                                       ^

R/tree.R:39:27: style: Put spaces around all infix operators.

result <- list(ingoing=NULL, outgoing=NULL)
                         ~^~

R/tree.R:39:42: style: Put spaces around all infix operators.

result <- list(ingoing=NULL, outgoing=NULL)
                                        ~^~

R/tree.R:48:33: style: Only use double-quotes.

tree.in <- tree.in[i, c('source', 'distance')]
                                ^~~~~~~~

R/tree.R:48:43: style: Only use double-quotes.

tree.in <- tree.in[i, c('source', 'distance')]
                                          ^~~~~~~~~~

R/tree.R:49:56: style: Commas should always have a space after.

tree.in <- tree.in[!duplicated(tree.in$source),]
                                                       ^

R/tree.R:51:37: style: Only use double-quotes.

​        colnames(tree.in)[1:2] <- c('node', 'level')
                                    ^~~~~~

R/tree.R:51:45: style: Only use double-quotes.

​        colnames(tree.in)[1:2] <- c('node', 'level')
                                            ^~~~~~~

R/tree.R:54:12: style: Place a space before left parenthesis, except in a function call.

for(lev in rev(seq_len(max(tree.in$level)))) {
           ^

R/tree.R:55:16: style: Place a space before left parenthesis, except in a function call.

for(src in tree.in$node[tree.in$level == lev]) {
               ^

R/tree.R:65:38: style: Put spaces around all infix operators.

​                stopifnot(length(dst)>0)
                                    ~^~

R/tree.R:78:35: style: Only use double-quotes.

tree.out <- tree.out[i, c('destination', 'distance')]
                                  ^~~~~~~~~~~~~

R/tree.R:78:50: style: Only use double-quotes.

tree.out <- tree.out[i, c('destination', 'distance')]
                                                 ^~~~~~~~~~

R/tree.R:79:64: style: Commas should always have a space after.

tree.out <- tree.out[!duplicated(tree.out$destination),]
                                                               ^

R/tree.R:81:38: style: Only use double-quotes.

​        colnames(tree.out)[1:2] <- c('node', 'level')
                                     ^~~~~~

R/tree.R:81:46: style: Only use double-quotes.

​        colnames(tree.out)[1:2] <- c('node', 'level')
                                             ^~~~~~~

R/tree.R:84:12: style: Place a space before left parenthesis, except in a function call.

for(lev in rev(seq_len(max(tree.out$level)))) {
           ^

R/tree.R:85:16: style: Place a space before left parenthesis, except in a function call.

for(dst in tree.out$node[tree.out$level == lev]) {
               ^

R/tree.R:95:38: style: Put spaces around all infix operators.

​                stopifnot(length(src)>0)
                                    ~^~

R/tree.R:132:1: style: Lines should not be more than 80 characters.

##'   \item John Q. Walker II, A node positioning algorithm for general tress.\cr
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

position_tree <- function(tree,
^

R/tree.R:146:1: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​{
^

R/tree.R:154:14: style: Place a space before left parenthesis, except in a function call.

while(all(!is.null(left_most),
             ^

R/tree.R:164:16: style: Place a space before left parenthesis, except in a function call.

for(i in seq_len(compare_depth)) {
               ^

R/tree.R:184:22: style: Place a space before left parenthesis, except in a function call.

while(all(!is.null(temp_node),
                     ^

R/tree.R:196:26: style: Place a space before left parenthesis, except in a function call.

while(!identical(temp_node, ancestor_neighbor)) {
                         ^

R/tree.R:198:1: style: Lines should not be more than 80 characters.

​                        set_modifier(temp_node, modifier(temp_node) + move_distance)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/tree.R:228:29: style: Put spaces around all infix operators.

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

R/tree.R:243:18: style: Place a space before left parenthesis, except in a function call.

while(all(is.null(left_most),
                 ^

R/tree.R:275:30: style: Put spaces around all infix operators.

return(n[i[1]-1])
                            ~^~

R/tree.R:391:26: style: Put spaces around all infix operators.

return(s[i[1]-1])
                        ~^~

R/tree.R:400:26: style: Put spaces around all infix operators.

return(s[i[1]+1])
                        ~^~

R/tree.R:433:18: style: Place a space before left parenthesis, except in a function call.

while(has_right_sibling(right_most)) {
                 ^

R/tree.R:484:22: style: Only use double-quotes.

​                stop('Undefined orientation')
                     ^~~~~~~~~~~~~~~~~~~~~~~

R/tree.R:502:22: style: Only use double-quotes.

​                stop('Tree outside drawable extents range')
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/tree.R:532:21: style: Only use double-quotes.

return(tree[, c('node', 'parent', 'level', 'x', 'y')])
                    ^~~~~~

R/tree.R:532:29: style: Only use double-quotes.

return(tree[, c('node', 'parent', 'level', 'x', 'y')])
                            ^~~~~~~~

R/tree.R:532:39: style: Only use double-quotes.

return(tree[, c('node', 'parent', 'level', 'x', 'y')])
                                      ^~~~~~~

R/tree.R:532:48: style: Only use double-quotes.

return(tree[, c('node', 'parent', 'level', 'x', 'y')])
                                               ^~~

R/tree.R:532:53: style: Only use double-quotes.

return(tree[, c('node', 'parent', 'level', 'x', 'y')])
                                                    ^~~

tests/arguments.R:33:57: style: Put spaces around all infix operators.

tools::assertError(IngoingContactChain(data.frame(source=1L,
                                                       ~^~

tests/arguments.R:34:62: style: Put spaces around all infix operators.

destination=2L,
                                                            ~^~

tests/arguments.R:35:52: style: Put spaces around all infix operators.

t=as.Date('2011-08-10')),
                                                  ~^~

tests/arguments.R:35:61: style: Only use double-quotes.

t=as.Date('2011-08-10')),
                                                            ^~~~~~~~~~~~

tests/arguments.R:36:44: style: Put spaces around all infix operators.

tEnd='2005-10-31',
                                          ~^~

tests/arguments.R:36:45: style: Only use double-quotes.

tEnd='2005-10-31',
                                            ^~~~~~~~~~~~

tests/arguments.R:37:44: style: Put spaces around all infix operators.

days=90))
                                          ~^~

tests/arguments.R:43:57: style: Put spaces around all infix operators.

tools::assertError(IngoingContactChain(data.frame(source=1L,
                                                       ~^~

tests/arguments.R:44:62: style: Put spaces around all infix operators.

destination=2L,
                                                            ~^~

tests/arguments.R:45:52: style: Put spaces around all infix operators.

t=as.Date('2011-08-10')),
                                                  ~^~

tests/arguments.R:45:61: style: Only use double-quotes.

t=as.Date('2011-08-10')),
                                                            ^~~~~~~~~~~~

tests/arguments.R:46:44: style: Put spaces around all infix operators.

root=1,
                                          ~^~

tests/arguments.R:47:44: style: Put spaces around all infix operators.

days=90))
                                          ~^~

tests/arguments.R:53:57: style: Put spaces around all infix operators.

tools::assertError(IngoingContactChain(data.frame(source=1L,
                                                       ~^~

tests/arguments.R:54:62: style: Put spaces around all infix operators.

destination=2L,
                                                            ~^~

Please sign in to comment.