Skip to content

Commit

Permalink
code style: change to use double-quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
stewid committed Nov 2, 2019
1 parent f2854eb commit 024a79c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions R/tree.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ build_tree <- function(network_structure)

if (nrow(tree.in)) {
i <- order(tree.in$distance, tree.in$source)
tree.in <- tree.in[i, c('source', 'distance')]
tree.in <- tree.in[i, c("source", "distance")]
tree.in <- tree.in[!duplicated(tree.in$source),]
tree.in$parent <- NA_character_
colnames(tree.in)[1:2] <- c('node', 'level')
colnames(tree.in)[1:2] <- c("node", "level")
tree.in <- tree.in[, colnames(root_node)]

for(lev in rev(seq_len(max(tree.in$level)))) {
Expand All @@ -75,10 +75,10 @@ build_tree <- function(network_structure)

if (nrow(tree.out)) {
i <- order(tree.out$distance, tree.out$destination)
tree.out <- tree.out[i, c('destination', 'distance')]
tree.out <- tree.out[i, c("destination", "distance")]
tree.out <- tree.out[!duplicated(tree.out$destination),]
tree.out$parent <- NA_character_
colnames(tree.out)[1:2] <- c('node', 'level')
colnames(tree.out)[1:2] <- c("node", "level")
tree.out <- tree.out[, colnames(root_node)]

for(lev in rev(seq_len(max(tree.out$level)))) {
Expand Down Expand Up @@ -481,7 +481,7 @@ position_tree <- function(tree,
x_temp <- x + node_level(node) * level_separation
y_temp <- y + prelim(node) + modsum
} else {
stop('Undefined orientation')
stop("Undefined orientation")
}

## Check that x_temp and y_temp are of the proper size.
Expand All @@ -499,7 +499,7 @@ position_tree <- function(tree,
second_walk(right_sibling(node), modsum)
}
} else {
stop('Tree outside drawable extents range')
stop("Tree outside drawable extents range")
}
}

Expand Down Expand Up @@ -529,5 +529,5 @@ position_tree <- function(tree,

second_walk(root(), 0)

return(tree[, c('node', 'parent', 'level', 'x', 'y')])
return(tree[, c("node", "parent", "level", "x", "y")])
}

1 comment on commit 024a79c

@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/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/plot.R:82:1: style: Lines should not be more than 80 characters.

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

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

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

R/plot.R:107: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:346:1: style: Lines should not be more than 80 characters.

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

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

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

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

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

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

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

R/report.R:354: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:401: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:49:56: style: Commas should always have a space after.

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

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:79:64: style: Commas should always have a space after.

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

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)) {
                 ^

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,
                                                            ~^~

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

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

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

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

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

root=1,
                                          ~^~

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

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

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

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

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

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

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

destination=2L,
                                                             ~^~

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

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

tests/arguments.R:64:62: style: Only use double-quotes.

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

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

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

tests/arguments.R:65:46: style: Only use double-quotes.

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

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

days=90))
                                           ~^~

tests/arguments.R:72:58: style: Put spaces around all infix operators.

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

tests/arguments.R:73:63: style: Put spaces around all infix operators.

destination=2L,
                                                             ~^~

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

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

tests/arguments.R:74:62: style: Only use double-quotes.

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

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

root=1,
                                           ~^~

Please sign in to comment.