Skip to content

Commit ec63220

Browse files
committed
ordena por contagem_cnefe e desvio_metros antes de resolver empates
1 parent 8f2b041 commit ec63220

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

R/geocode.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,5 +308,5 @@ geocode <- function(enderecos,
308308
return(output_sf)
309309
}
310310

311-
return(output_df)
311+
return(output_df[])
312312
}

R/trata_empates_geocode.R

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,10 @@ trata_empates_geocode <- function(output_df = parent.frame()$output_df,
188188
# drop geocodebr dist columns
189189
output_df2[, dist_geocodebr := NULL]
190190

191-
return(output_df2)
191+
return(output_df2[])
192192
} # nocov end
193193

194194

195-
196-
197-
198-
199195
# calculate distances between pairs of coodinates
200196
dt_haversine <- function(lat_from, lon_from, lat_to, lon_to, r = 6378137){ # nocov start
201197
radians <- pi/180

R/utils.R

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,17 @@ merge_results <- function(con,
170170
"SELECT {select_clause}
171171
FROM {x}
172172
LEFT JOIN (
173-
SELECT * FROM {y}
174-
ORDER BY tempidgeocodebr ) AS sorted_output
173+
SELECT * FROM {y}
174+
ORDER BY tempidgeocodebr, contagem_cnefe DESC, desvio_metros
175+
) AS sorted_output
175176
ON {join_condition};"
176-
)
177+
)
177178

178179
# Execute the query and fetch the merged data
179180
merged_data <- DBI::dbGetQuery(con, query)
180181

181182
return(merged_data)
182-
}
183-
184-
183+
}
185184

186185

187186
#' create index

0 commit comments

Comments
 (0)