Skip to content

Commit

Permalink
Fix lintr indentation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pdil committed Dec 10, 2023
1 parent 76a2b88 commit 2d27f7a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
5 changes: 2 additions & 3 deletions R/fips.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ fips <- function(state, county = c()) {
result <- c(
result,
df$fips[which(
(name %in% county_i | name %in% paste(county_i, "county"))
&
(state_abbr %in% state_ | state_full %in% state_)
(name %in% county_i | name %in% paste(county_i, "county")) &
(state_abbr %in% state_ | state_full %in% state_)
)]
)
}
Expand Down
12 changes: 8 additions & 4 deletions R/plot-map.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,26 +123,30 @@ plot_usmap <- function(regions = c("states", "state", "counties", "county"),
centroid_labels <- centroid_labels[
centroid_labels$full %in% include |
centroid_labels$abbr %in% include |
centroid_labels$fips %in% include, ]
centroid_labels$fips %in% include,
]
}

if (length(exclude) > 0) {
centroid_labels <- centroid_labels[!(
centroid_labels$full %in% exclude |
centroid_labels$abbr %in% exclude |
centroid_labels$fips %in% exclude |
substr(centroid_labels$fips, 1, 2) %in% exclude), ]
substr(centroid_labels$fips, 1, 2) %in% exclude
), ]
}

if (regions_ == "county" || regions_ == "counties") {
label_layer <- ggplot2::geom_text(
data = centroid_labels,
ggplot2::aes(x = .data$x, y = .data$y, label = sub(" County", "", .data$county)),
color = label_color)
color = label_color
)
} else {
label_layer <- ggplot2::geom_text(
data = centroid_labels,
ggplot2::aes(x = .data$x, y = .data$y, label = .data$abbr), color = label_color)
ggplot2::aes(x = .data$x, y = .data$y, label = .data$abbr), color = label_color
)
}
} else {
label_layer <- ggplot2::geom_blank()
Expand Down
6 changes: 3 additions & 3 deletions R/transform.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ usmap_transform.data.frame <- function(data,

hawaii <- transformed[
transformed@coords[, 1] >= hi_bbox[1, 1] &
transformed@coords[, 1] <= hi_bbox[1, 2] &
transformed@coords[, 2] >= hi_bbox[2, 1] &
transformed@coords[, 2] <= hi_bbox[2, 2],
transformed@coords[, 1] <= hi_bbox[1, 2] &
transformed@coords[, 2] >= hi_bbox[2, 1] &
transformed@coords[, 2] <= hi_bbox[2, 2],
]

if (length(hawaii) > 0) {
Expand Down

0 comments on commit 2d27f7a

Please sign in to comment.